我正在尝试创建如下所示的内容:
但是,它目前是这样的(缩小了一点):
我不知道怎么把头像放在右下角。
这是我的布局:
<RelativeLayout android:id="@+id/circle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="@color/white"
android:layout_marginRight="10dp">
<TextView
android:id="@+id/bg"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:background="@drawable/bg" />
<ImageView
android:id="@+id/profile_picture"
android:layout_width="18dp"
android:layout_height="18dp"
android:src="@drawable/avatar"/>
</RelativeLayout>
这是 bg
可绘制对象:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="#4a9ef7"/>
<size android:width="50dp" android:height="50dp"/>
</shape>
</item>
</layer-list>
我应该改变什么?
最佳答案
<RelativeLayout android:id="@+id/circle"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:background="@color/white"
android:layout_marginRight="10dp">
<TextView
android:id="@+id/bg"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:background="@drawable/bg" />
<ImageView
android:id="@+id/profile_picture"
android:layout_width="18dp"
android:layout_height="18dp"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:src="@drawable/avatar"/>
</RelativeLayout>
关于android - 将图像定位在形状的右下角,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31823378/