I want to align 2 images in right side in linear layout.How to add space between 2 images? Here is my code.
Vechile.xml
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Image
android:id="@+id/image1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img1"
android:layout_marginEnd="20dp" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<View
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
<Image
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:src="@drawable/img2"
android:id="@+id/image2"/>
</LinearLayout>
</LinearLayout>
Set your LinearLayout gravity right and take some margin in your ImageViews like this:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="right">
<ImageView
android:id="@+id/image1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:background="@drawable/arrow_down_black_24dp"
/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/image2"
android:layout_margin="5dp"
android:background="@drawable/arrow_down_black_24dp"
/>
</LinearLayout>