2017-03-26 17 views
0

水平スクロールビューが機能しない理由、垂直スクロールビューがうまく動作しないこと、誰かが私を明確にすることができるのか分かりませんか?私は答えをオンラインで検索したが、何も動作していないようだ、私はすでにネストされたscrollviewとlistviewを試みた。私のアイデアは、垂直線形レイアウトで構成されたクイズを作成することですが、質問の中には複数のチェックボックスの回答があり、画面の幅に合わないので、水平スクロールビューを追加しようとしました。それらがひどくフォーマットされていないチェックボックス。あなたはJavaファイルでは、あなたのレイアウトファイルにHorizo​​ntalScrollViewが動作しないのはなぜですか(Android)?

<android.support.v7.widget.RecyclerView 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:id="@+id/recycler_view" 
      xmlns:android="http://schemas.android.com/apk/res/android" /> 

をリサイクルビューを追加することができます

<ScrollView 
xmlns:android="http://schemas.android.co... 
xmlns:app="http://schemas.android.com/ap... 
xmlns:tools="http://schemas.android.com/... 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
tools:context="com.example.android.quiz.... 

<LinearLayout 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical"> 

<Textview> </TextView> 

<HorizontalScrollView 
android:layout_width="wrap_content" 
android:layout_height="match_parent"~ 
android:scrollbars="horizontal" 
android:nestedScrollingEnabled="true"> 

<LinearLayout 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="horizontal"> 

<CheckBox><CheckBox/> 

<LinearLayout/> 

<HorizontalScrollView/> 

<LinearLayout/> 

<Scrollview/> 
+1

にその向きを設定します。 – Wizard

+0

それでは、解決策は何ですか? –

+0

このような状況は避けてください。そうした場合は、TouchEventを手動で管理する必要があります。代わりに、複数のアイテムで 'recyclerview'を使用しています。 – Wizard

答えて

1

は `scrollable``内Scrollable`コンテンツは良い習慣ではありません置く水平

LinearLayoutManager LayoutManager = new LinearLayoutManager(this); 
LayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL); 
RecyclerView.setLayoutManager(LayoutManager); 
関連する問題