本文介绍了将ImageView与LinearLayout的右下角对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将ImageView放在LinearLayout的右下角....我将代码写为波纹管:
I'm triying to put an ImageView in bottom right of LinearLayout ....I wrote the code as bellow :
style.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="90dp"
android:background="@drawable/my_background"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
android:src="@drawable/my_small_image" />
</LinearLayout>
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
此代码在右下角生成ImageView'my_small_image',但在左下角需要它.有人对此有任何想法吗?
This code results in the ImageView 'my_small_image' at the bottom right, but I need it in the bottom left.Anyone have any ideas about this?
我希望这里有人可以帮助我.
I hope somebody here can help me.
最诚挚的问候,预先感谢,法德尔.
Best regards and thanks in advance, Fadel.
推荐答案
使用RelativeLayout
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>
这篇关于将ImageView与LinearLayout的右下角对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!