0

また、ScrollViewをTableLayoutに組み込む必要がありますか?これも可能ですか?私は、画面の任意の数の行を動的に作成したいが、行をスクロール可能にする必要がある。TableLayoutは垂直スクロールバーを提供しますか?

私は、LinearLayoutを使ってこれを長時間使ってもらうために無駄に努力してきました。そして、TableLayoutまたはRelativeLayoutのいずれかに移行する時が来たと思います。

答えて

2

」のなしリスト "スタイルのビューは自動的にスクロールします。 LinearLayout、TableLayout、RelativeLayout、他の人が指摘したように、ScrollViewで簡単にラップすることはできないので、必要ない機能です。

+0

OK、ありがとう。私は理論的なレイアウトを投稿し、誰かがそれに泥を投げ入れるかどうかを見極めるつもりです。 –

4

スクロールレイアウト内でテーブルレイアウトを使用することは可能です。あなただけのように下にあなたのTableLayoutためScrollViewを指定する必要があります例えば 、あなたがテーブルレイアウトの代わりにリニアレイアウトを使用することができます

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

      <LinearLayout 
       xmlns:android="http://schemas.android.com/apk/res/android" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:orientation="vertical" > 
</LinearLayout> 

</ScrollView> 

..

+0

はい、私はTableLayoutを使用できます。私の質問は、画面に表示するにはあまりにも多くの行がある場合、TableLayoutは、垂直スクロールバーを追加しますか? –

+0

@ Clay Shannon:はい、うまくいきます。試してみてください。それが私に知らせてくれないなら... –

1

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:background="#ffffff" 
    android:layout_height="fill_parent"> 

    <RelativeLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="#ffffff"> 

     <TableLayout 
      android:id="@+id/myTableLayout" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_gravity="center" 
      android:shrinkColumns="1"/>  

    </RelativeLayout> 

</ScrollView> 
関連する問題