2016-05-15 4 views
0

Androidには新しく、10以上のアイテムのリストビューをスクロールすることになっているスクロールビューを作成しています。AndroidのScrollViewの高さが短すぎる

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:paddingBottom="@dimen/activity_vertical_margin" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     tools:context="com.naqishop.naqi.MainActivity" 
     tools:showIn="@layout/activity_main"> 


     <ScrollView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:id="@+id/scrollView"> 

     <ListView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/listView" 
      android:entries="@array/options" /> 


     </ScrollView> 



</LinearLayout> 

問題は、私は一度つ以上の項目を表示するには、スクロールビューを拡張することができないということです。私はsuggestd here として

android:fillViewport="true" 

を追加しようとしたが、それは高さを変更していないまた (500dpに値を割り当てるように)scrollviewのlayout_heightを改ざんしようとしました。あなたのヒントを感謝します。

+1

'ScrollView'には' android:layout_height = "wrap_content" 'を使用できません:-( ' android:layout_height = "match_parent" "' –

+1

に設定してください。それはリストビューを使用しています。スクロールが入っています。 –

+0

@MichaelKatkov良い点。ありがとう! – Karlom

答えて

2

と設定されているためです。それを android:layout_height="match_parent"に置き換えると、全体の高さが上がります。

関連する問題