I'm learning Android programming and I'm trying to exactly reproduce the layout of a particular list item example of the Material design guidelines but I'm not sure how doing it:
Can you give me some help? Thank you.
1- In you drawables add a new xml file and name it "circle_avatar.xml"
and insert the following code :
<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- In your main xml layout:
<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. You can always make changes to that to fit your needs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.