我有我認爲是一個簡單的佈局。這包含一個滾動視圖,在這個水平滾動視圖中,所以我可以滾動雙向。我簡化了這個例子,所以它有一個包含一個TextView和另一個RelativeLayout的RelativeLayout。下面是XML: RelativeLayout不顯示項目左邊
<HorizontalScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fadeScrollbars="false"
android:scrollbarAlwaysDrawHorizontalTrack="true"
android:fillViewport="true">
<RelativeLayout
android:id="@+id/mainLayout"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<TextView
android:id="@+id/myText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="TEXT LABEL" />
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/myText">
<Button android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@+id/button1"
android:layout_above="@+id/button1"
android:text="2"/>
<Button android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"/>
<Button android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/button1"
android:text="3"/>
</RelativeLayout>
</RelativeLayout>
</HorizontalScrollView>
</ScrollView>
我可以看到按鈕1和3,但我沒有看到按鈕2.我需要做這樣不幸的是,因爲頁面是動態生成的(這個XML是一種簡化我正在做的版本),我只知道我需要留下什麼。我曾經在一點工作,但不得不重新安排一些其他的代碼,並打破了。我錯過了什麼?
下面是一個快照的鏈接:snapshot
你可以發佈一個鏈接到它現在的樣子嗎? – FoamyGuy 2012-04-16 19:56:42
按鈕2應該放在哪裏? – 207 2012-04-16 20:24:06
button2應該與button1的左上角對齊。我知道我可以將button1與button2的右下角對齊,但我需要以這種方式構建它。 – 2012-04-16 21:00:53