i am trying to add 4 images, of half of the width of mobile screen device size with left right margin.
Here i am using a layout as RelativeLayout
where i want to create a grid view sort of view. Here is how my layout should look like:
Here is how i am trying to show the layout view in android XML.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="center"
android:layout_gravity="center"
android:id="@+id/li_profile"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/relative1_profile"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:src="@drawable/lamp"
android:id="@+id/profile_image1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:src="@drawable/lamp"
android:id="@+id/profile_image2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
<RelativeLayout
android:layout_below="@+id/relative1_profile"
android:id="@+id/relative1_profile1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:src="@drawable/lamp"
android:id="@+id/profile_image3"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<ImageView
android:src="@drawable/lamp"
android:id="@+id/profile_image4"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</RelativeLayout>
</RelativeLayout>
as per the above code we are trying to add this view in a ViewPager so it can swipable.
To make it consistent with different screen sizes we have added some dynamic margin to external @+id/relative1_profile
.
Any suggestions related to this will be helpful to understand. We tried working with GridView
as well, but then the "brown" image is not displaying well in all the mobile resolutions.
Thank you! (in advance)