我有一个很简单的问题要问:我需要在屏幕右下方的ImageView上放大小的标志,大的屏幕,但我不知道如何设置坐标或如何说ImageViews处于相对位置。Android ImageView ImageView
事情是这样的:
我有一个很简单的问题要问:我需要在屏幕右下方的ImageView上放大小的标志,大的屏幕,但我不知道如何设置坐标或如何说ImageViews处于相对位置。Android ImageView ImageView
事情是这样的:
试试这个
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:src="@drawable/ic_launcher" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:src="@drawable/ic_launcher" />
</RelativeLayout>
输出
谢谢我试过这个,第一次尝试 – Stefano 2012-07-13 10:10:58
'RelativeLayout'是关键!我正在使用线性布局。 – ThunderWiring 2017-08-13 09:27:50
使用的FrameLayout。
按照谷歌的Blogspot样品
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="center"
android:src="@drawable/golden_gate" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_gravity="center_horizontal|bottom"
android:padding="12dip"
android:background="#AA000000"
android:textColor="#ffffffff"
android:text="Golden Gate" />
</FrameLayout>
它会给你以下输出
只是调整,以满足您的需求。
你可以看看FrameLayout。 [Heres](http://mobileorchard.com/android-app-development-%E2%80%93-layouts-part-three-frame-layout-and-scroll-view/)一个很好的链接,希望它可以帮助你。 – Antrromet 2012-07-13 10:00:10