2011-05-12 55 views
0

我有一個問題,對於一些有經驗的人聽起來很愚蠢,但我無法解決問題。Android添加視圖,其中一個水平旁邊

我想在一個滾動視圖中水平地添加視圖,一個接一個。 任何人都可以推薦我如何使視圖水平安排?

在此先感謝!

+0

視圖必須是動態的嗎? – Hades 2011-05-12 06:56:43

回答

3

是這樣的?這些TextViews將水平滾動:

<?xml version="1.0" encoding="utf-8"?> 
<HorizontalScrollView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" android:layout_height="match_parent"> 
    <LinearLayout android:layout_width="match_parent" 
     android:id="@+id/linearLayout1" android:layout_height="match_parent"> 
     <TextView android:text="TextView" android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
     <TextView android:text="TextView" android:id="@+id/textView2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
     <TextView android:text="TextView" android:id="@+id/textView3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 
</HorizontalScrollView> 
+0

我不得不將1.6從「match_parent」更改爲「fill_parent」 – mxg 2011-05-12 07:31:25

相關問題