我想在下面附上分层图像。
目前,我正在这样做
layout.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<View
android:id="@+id/view1"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="10dp"
android:background="@drawable/images1">
</View>
<View
android:id="@+id/view2"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
android:background="@drawable/images1">
</View>
<View
android:id="@+id/view3"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_marginTop="30dp"
android:layout_marginLeft="20dp"
android:background="@drawable/images1">
</View>
</RelativeLayout>
但是我觉得这种使用XML的手动方法可能会有所不同,并且会根据不同的设备和屏幕类型做出反应。那么,我怎样才能以更好或最好的方式实现它呢?如何使其具有动态性?
谢谢。