I\'m triying to put an ImageView in bottom right of LinearLayout .... I wrote the code as bellow :
style.xml:
I would recomend Using RelativeLayout
but if you have to useLinearLayout
i know that android:scaleType"
can help center or move image, did you try android:scaleType="fitEnd"
or android:scaleType="fitXY"
for more Try This
Use RelativeLayout
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="90dp"
android:background="@drawable/my_background"
android:layout_alignParentBottom="true"
>
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:src="@drawable/my_small_image" />
</RelativeLayout>
Using LinearLayout
is possible:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:orientation="vertical">
<!-- other elements in linear layout here -->
<!-- making a RelativeLayout un-desirable -->
<ImageView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:scaleType="fitEnd"
android:src="@drawable/your_image" />
</LinearLayout>
This will position the image at the center-bottom, for bottom-right use
android:layout_gravity="right"
In LinearLayout
you can use -
android:layout_gravity="bottom|right"