我嘗試在android layout.xml文件中創建2行按鈕。 第一行是左對齊的,第二行是中心對齊的。如何在android layout.xml文件中創建2行按鈕
這是我做的,但我最終得到1排按鈕。你能告訴我我做錯了什麼嗎?
enter code here
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="bottom|left"
>
<Button
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_gravity="bottom|center"
>
<Button
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/btn3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
</FrameLayout>
</pre>
相對佈局是迄今爲止最昂貴的佈局機制。來源,Google工程師:https://plus.google.com/+KirillGrouchnikov/posts/fFfm7jKn7q5 – 2014-01-02 18:53:21
您的鏈接「文章」(更像是句子)正在討論適配器中的佈局。 OP不要求這是在適配器中。只是因爲這些話來自聖神的口中,並不意味着沒有更多的事情發生。 – 2014-01-02 21:25:56