res/layout/numberplate.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="30dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/background"
android:orientation="horizontal">
<LinearLayout
android:layout_margin="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="46dp"
android:layout_height="46dp"
android:background="@mipmap/ic_launcher" />
<TextView
android:layout_width="wrap_content"
android:layout_height="46dp"
android:layout_marginLeft="20dp"
android:gravity="center"
android:text="Number"
android:textSize="25dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
res/drawable/background.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#d0d0d0" />
<corners android:radius="5dp" />
<stroke android:color="#202020" android:width="3dp"/>
</shape>
您可以更改这些值以匹配您想要的方式。希望这有所帮助。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="30dp">
<ImageView
android:layout_width="46dp"
android:layout_height="46dp"
android:layout_gravity="center"
android:background="@drawable/your_numberplate_image" />
<TextView
android:layout_width="46dp"
android:layout_height="46dp"
android:layout_marginLeft="10dp"
android:gravity="center"
android:text="Number"
android:textSize="25dp" />
</RelativeLayout>
drawableLeft
属性来做到这一点? - user5892486TextView
。 - user5892486