android:foreground=”@drawable/ceshi”设置前景
android:foregroundGravity=”center_horizontal”设置前景位置
代码示例
<?xml version=”1.0” encoding=”utf-8”?>
android:layout_height=”match_parent”
xmlns:android=”http://schemas.android.com/apk/res/android">
android:layout_width=”400dp”
android:layout_height=”400dp”
android:background=”@color/purple_200”
/>
android:layout_width=”200dp”
android:layout_height=”200dp”
android:foreground=”@drawable/ceshi”
android:foregroundGravity=”center_horizontal”
android:background=”#ff0000”
/>
android:layout_width=”100dp”
android:layout_height=”100dp”
android:background=”#ffff00”
/>