2017-09-12 15 views
0

水平スクロール可能なリストビューを作成しました。そして、私はdbから何の問題もなく埋め込むことができます。問題は;アイテムの全長は、第1アイテムの長さに設定される。この問題へのリストビューアイテムの長さが最初のアイテムによって設定されるのはなぜですか?

Like this

<RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal"> 
    <HorizontalScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" > 
      <ListView 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"/> 
    </HorizontalScrollView> 
</RelativeLayout> 
+0

は、スクロールビューにRecyclerViewまたはListViewコントロールを追加することはありません一致させる必要があります。そうすると、ユーザーインターフェイスのパフォーマンスが低下し、ユーザーエクスペリエンスが低下します.https://developer.android.com/reference/android/widget/ScrollView.htmlあなたはこの目的のためにReyclerViewを使うことができます – Raghunandan

答えて

1

簡単な解決策は、Recyclerviewの代わりに、リストビューを使用することです。 LinearLayoutにHorizo​​ntalScrollviewを追加しても機能しません。 私はすでに多くのソリューションを投稿しましたhere 私のソリューションはRecyclerviewでした。 そしてhereから私はこれを使うことを学んだ。

0

あなたは、リストビューの高さは、親

<RelativeLayout 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:orientation="horizontal"> 
    <HorizontalScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 
     <ListView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent"/> 
    </HorizontalScrollView> 
</RelativeLayout> 
関連する問題