You can set android:layout_weight="2"
to your container and for every child set android:layout_weight="1"
and android:layout_width="0dp"
like this:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="2">
<ImageButton
android:background="@null"
android:id="@+id/button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginBottom="20dp"
android:layout_weight="1"
android:layout_gravity="left"/>
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:background="@null"
android:text="Read more.."
android:textAllCaps="false"
android:layout_weight="1"
android:textColor="@android:color/white"
android:textSize="14sp" />
</LinearLayout>
But if you already developed some ios apps before as your name is implying, you may find it more easy to work with ConstarintLayout - one layout to fit all screen sizes (its very similar to the drag and drop editor in ios I just cant remember its name)
Here is an example using ConstraintLayout
:
<Button
android:id="@+id/button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Button"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toEndOf="@+id/button2"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Button"
app:layout_constraintBottom_toBottomOf="@+id/button"
app:layout_constraintEnd_toStartOf="@+id/button"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/button" />
</android.support.constraint.ConstraintLayout>
Edit according to what you asked:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_weight="3">
<Button
android:id="@+id/button"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="left"
android:layout_gravity="start"/>
<Button
android:id="@+id/button2"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="end"
android:text="Read more.."
android:layout_weight="1"
android:textSize="14sp" />
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:text="right"
android:layout_weight="1"/>
</LinearLayout>