0

I have 3 'groups' of items in my layout:

  1. Button + TextView (should be on the right side)
  2. ImageView + ImageView + TextView (should be in center)
  3. TextView + Button (should be on the left side)

It's like a footer for tablet. But all my items are next to each other starting from left side. I tried grouping them to separate layouts but it doesn't help.

Here is my code:

    <LinearLayout
        android:id="@+id/footer"
        android:layout_width="match_parent"
        android:layout_height="40dp"
        android:orientation="horizontal"
        android:layout_gravity="bottom"
        android:background="@android:color/black">

            <Button
                android:background="@drawable/arrow_left"
                android:layout_width="50dp"
                android:layout_height="match_parent"
                android:id="@+id/footer_left_arrow"
                android:layout_margin="10dp"/>

            <TextView
                android:text="text"
                android:textColor="#FFFFFF"
                android:textSize="20sp"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:id="@+id/footer_left_text"/>

            <ImageView
                android:background="@drawable/logo"
                android:layout_marginTop="5dp"
                android:layout_marginBottom="5dp"
                android:layout_width="50dp"
                android:layout_height="20dp"
                android:layout_gravity="center"/>

            <ImageView
                    android:background="@drawable/footer_vertical_line"
                android:layout_margin="5dp"
                android:layout_width="wrap_content"
                android:layout_height="match_parent" />

            <TextView
                android:text="text"
                android:textColor="#FFFFFF"
                android:textSize="12sp"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:gravity="center" />

            <TextView
                android:text="text"
                android:textColor="#FFFFFF"
                android:textSize="20sp"
                android:layout_width="wrap_content"
                android:layout_height="match_parent" />

            <Button
                android:background="@drawable/arrow_right"
                android:layout_width="50dp"
                android:layout_height="match_parent"
                android:layout_margin="10dp" />

    </LinearLayout>
Charuක
  • 12,953
  • 5
  • 50
  • 88

1 Answers1

0
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/footer"
    android:layout_width="match_parent"
    android:layout_height="40dp"
    android:layout_gravity="bottom"
    android:background="@android:color/black"
    android:orientation="horizontal">

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="center"
        android:orientation="vertical">

        <Button
            android:id="@+id/footer_left_arrow"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:background="@drawable/arrow_left" />

        <TextView
            android:id="@+id/footer_left_text"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:text="text"
            android:textColor="#FFFFFF"
            android:textSize="20sp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:gravity="center"
        android:orientation="vertical">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:background="@drawable/footer_vertical_line" />

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:background="@android:drawable/ic_input_add" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:gravity="center"
            android:text="text"
            android:textColor="#FFFFFF"
            android:textSize="12sp" />

    </LinearLayout>

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical"
        android:gravity="center">


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:text="text"
            android:textColor="#FFFFFF"
            android:textSize="20sp" />

        <Button
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:background="@drawable/arrow_right" />

    </LinearLayout>

</LinearLayout>

Use this.

Rishabh Mahatha
  • 1,251
  • 9
  • 19