1
0

More than 1 year has passed since last update.

LinearLayoutで固定サイズの子ビューの残りを別の子供ビューに割り当てる

Posted at

layout_heightに0dp、layout_weightを1にするだけ。

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <View
        android:id="@+id/header"
        android:layout_width="match_parent"
        android:layout_height="10dp">

    <View
        android:id="@+id/main"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

    <View
        android:id="@+id/footer"
        android:layout_width="match_parent"
        android:layout_height="10dp">
</LinearLayout>
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0