在Android Studio上已经存在的背景上添加多个图像
我是android编程新手,我想在已经存在的网格背景中添加图像 这是我的背景图片,我想在背景的左右两侧添加一些小图片。说我设计的动画图像,但我不知道程序。任何帮助都将不胜感激在Android Studio上已经存在的背景上添加多个图像,android,Android,我是android编程新手,我想在已经存在的网格背景中添加图像 这是我的背景图片,我想在背景的左右两侧添加一些小图片。说我设计的动画图像,但我不知道程序。任何帮助都将不胜感激 如果要将图像放在背景图像的前面,最好使用FrameLayout或RelativeLayout。如果不希望它位于顶部,而是位于侧面,则应使用“水平”方向的LinearLayout <FrameLayout android:id="@+id/my_ph" xmlns:android="http://schemas
如果要将图像放在背景图像的前面,最好使用FrameLayout或RelativeLayout。如果不希望它位于顶部,而是位于侧面,则应使用“水平”方向的LinearLayout
<FrameLayout android:id="@+id/my_ph"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/background_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/sketch" android:layout_alignParentTop="true"/>
<ImageView
android:id="@+id/image2"
android:layout_width="fill_parent"
android:layout_height="fill_paren"
android:layout_alignTop="@id/image"
android:layout_alignLeft="@id/image"
android:layout_alignRight="@id/image"
android:layout_alignBottomp="@id/image"
</FrameLayout>
为了清楚起见,您已经有一个图像作为背景,并且希望在其上有其他图像?是的,就是这样。感谢固定数量的图片或动态?谢谢你,我目前使用的是相对布局。
<LinearLayout
android:id="@+id/my_ph"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image1"
android:layout_width="fill_parent"
android:layout_height="fill_paren" </>
<ImageView
android:id="@+id/background_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/sketch" android:layout_alignParentTop="true"/>
<ImageView
android:id="@+id/image2"
android:layout_width="fill_parent"
android:layout_height="fill_paren" </>
</LinearLayout>