i'm trying to make ImageView
take match_parent of RelativeLayout
like this picture :
when i run my app ImageView
looks like that :
this my xml :
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linealL"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/khdar">
<RelativeLayout
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:id="@+id/RelativeLayout02"
android:layout_width="wrap_content"
android:background="@color/colorGriviewBorder"
android:layout_height="wrap_content" >
<LinearLayout
android:layout_margin="5dp"
android:id="@+id/LinearLayout01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/gradient"
android:orientation="vertical" >
<TextView
android:text="GIF"
android:textSize="16sp"
android:layout_gravity="center"
android:textColor="@color/colorGriviewBorder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/dev"/>
</LinearLayout>
<ImageView
android:padding="8dp"
android:layout_below="@+id/LinearLayout01"
android:contentDescription="@string/app_name"
android:id="@+id/imageSelectTo"
android:scaleType="fitXY"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_height="wrap_content"
android:layout_width="wrap_content"/>
</RelativeLayout>
</RelativeLayout>
Change layout_width
of ImageView to match_parent
and add one new attribute to it: android:adjustViewBounds="true"
.