Макет Android с 2 равномерно разнесенными кнопками
-
25-09-2019 - |
Вопрос
У меня есть этот макет, который работает правильно, относительную макет с видом текста и двумя кнопками, разнесенными равномерно под ним.
<RelativeLayout android:id="@+id/entrypopup"
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:padding="5px"
android:visibility="gone"
android:layout_below="@+id/ad"
android:background="#80000000">
<TextView android:id="@+id/title" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="Entry Popup..."
android:textColor="#ffffffff"
android:textSize="20sp" />
<TableLayout android:id="@+id/TableLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title">
<TableRow android:layout_weight="1">
<Button android:id="@+id/buttonVisit" android:text="View"
android:layout_height="fill_parent"
android:layout_width="0dip"
android:layout_weight="1"/>
<Button android:id="@+id/buttonCancel" android:text="Cancel"
android:layout_width="0dip"
android:layout_weight="1"
android:layout_height="fill_parent"/>
</TableRow>
</TableLayout>
</RelativeLayout>
Но бегущая майкутопт говорит, что «эта столовая макет или его родитель таблетки возможны бесполезными».
Есть ли способ сделать этот макет тогда без таблиц?
Решение
Сброс TableLayout
а также TableRow
, и просто используйте горизонтальный LinearLayout
на их месте. «Магия» в вашем 0dip
ширина и 1
Вес, который у вас уже есть.
Не связан с StackOverflow