2016-08-09 9 views
0

フラグメントを含むプロジェクトを作成しましたが、要素内のみ(または2つ、同じです)のScrollViewを挿入することはできません。事実、私はスクロールを見ることができますが、それは下がらない。それは、他のデバイス(タブレットなど)との不一致の原因になりますので、私は は、事前に 敬具FrameLayoutのScrollView

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:scrollbars = "vertical" 
android:fillViewport="true"> 

<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 

      <TextView 
       android:text="@string/my_string" 
       android:id="@+id/textView1" 
       android:layout_margin="10dp" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" /> 
</LinearLayout> 
    </ScrollView> 

をありがとう、これによりあなたはXMLコードを見つけるでしょう同封 DPでlayout_heightを追加する必要はありません更新

私は解決策を見つけました。 TextViewがレイアウト全体に埋め込まれているので、scrollViewはタブとtopBarを考慮して上から開始しました。私はいくつかの "\ n"を追加し、すべて正常に動作しています。 皆さん、ありがとうございます。

+0

あなたの 'TextView'が画面よりも大きな高さを持っていても、あなたは下にスクロールできないと言っていますか? – himanshu1496

+0

正確:/私は何をすべきかわかりません! – VittoriaFrau

+0

このレイアウトのデバイススクリーンショットを表示できますか? –

答えて

1

アンドロイドを削除しよう:このfillViewport = "true" をごscrollviewから

+0

動作しません:( – VittoriaFrau

0

あなたはmatch_parentにその高さを設定し、削除しているので、それが起こっているfillViewport

これを試してみてください:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:scrollbars = "vertical"> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content"> 

       <TextView 
        android:text="@string/my_string" 
        android:id="@+id/textView1" 
        android:layout_margin="10dp" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" /> 
    </LinearLayout> 
</ScrollView> 
+0

動作しません:( – VittoriaFrau

0

試用:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:scrollbars = "vertical" 
android:fillViewport="true"> 

<LinearLayout 
android:layout_width="match_parent" 
android:layout_height="wrap_content"> 

     <TextView 
      android:text="@string/my_string" 
      android:id="@+id/textView1" 
      android:layout_margin="10dp" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 
</LinearLayout> 
</ScrollView> 

基本的にandroid:layout_widthlinearLayoutに変更しました。これを試してみてください。

+0

あなたの助けていただきありがとうございます、しかし、おそらく私は問題を実現した、私の最後の更新を参照してください – VittoriaFrau