-1
我学习Android的编程和我试图精确地再现Material design guidelines的特定列表项实例的布局,但我不知道怎么做: 如何设计材料设计指南中的列表示例?
你能给我一些帮助? 谢谢。
我学习Android的编程和我试图精确地再现Material design guidelines的特定列表项实例的布局,但我不知道怎么做: 如何设计材料设计指南中的列表示例?
你能给我一些帮助? 谢谢。
1-在您添加可绘制一个新的XML文件,并将其命名为 “circle_avatar.xml”
,并插入下面的代码:
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:radius="100dip"/>
<solid
android:color="#ff4CAF50" />
<stroke
android:width="2dip"
android:color="#FFF" />
<padding
android:left="6dip"
android:right="6dip"
android:top="5dip"
android:bottom="5dip" />
</shape>
2。在你的主XML布局:
<FrameLayout
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginRight="20dp"
android:layout_marginTop="10dp"
android:id="@+id/layout_circle_avatar"
android:layout_gravity="center_vertical"
android:background="@drawable/circle_avatar">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/circle_pic"
android:src="@drawable/icon1"/>
</FrameLayout>
PS。您可以随时对其进行更改以符合您的需求