Я довольно большой нуб, когда дело доходит до андроида, и я застрял в ситуации. How it should beAndroid: наложение таблиц накладки Линейная компоновка
Я хочу, чтобы моя сервировку идти под мою кнопкой, расположенной в линейной компоновке, но он просто перекрывает.
В конце концов, мне нужно будет нажать кнопку, чтобы полностью скрыть стол.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="eu.agp_it.agpmobilemover.OverviewActivity">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="1.0"
android:gravity="center"
android:id="@+id/layout_button_today"
>
<Button
android:id="@+id/overview_button_today"
android:layout_height="wrap_content"
android:layout_weight="0.95"
android:layout_width="0dip"
android:textSize="20sp"
android:text="@string/overview_today"
android:gravity="center"/>
</LinearLayout>
<TableLayout
android:layout_width="20sp"
android:layout_height="fill_parent"
android:visibility="visible"
>
<TableRow>
<TextView android:id="@+id/label_depart" android:text="@string/overview_depart_time"/>
<TextView />
</TableRow>
</TableLayout>
<LinearLayout
android:id="@+id/layout_button_upcoming"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="1.0"
android:gravity="center"
android:layout_above="@id/layout_button_today">
<Button
android:id="@+id/overview_button_upcoming"
android:layout_height="wrap_content"
android:layout_weight="0.95"
android:layout_width="0dip"
android:textSize="20sp"
android:text="@string/overview_upcoming"
android:gravity="center"/>
</LinearLayout>
</RelativeLayout>
Используйте LinearLayout как root или правильно установите layout_above/layout_below. – Nfear
Использование LinearLayout вместо RelativeLayout и "fill_parent" устарело, если вы используете LinearLayout, тогда android: layout_height = "0dp" android: layout_weight = "1" в TableLayout –