带有底部矩形的圆形 Textview
Circular Textview with bottom rectangle
我正在尝试创建一个底部有矩形的圆形文本视图以供参考我在这里分享示例图像并编写我想要实现的代码
任何人都可以帮助我创建以下屏幕截图,在此先感谢。
试试这个
<?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:background="#ff0"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/myTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/ic_dot"
android:gravity="center"
android:padding="10dp"
android:text="sdsjhdsd"
android:textColor="#ff00" />
<TextView
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/myTv"
android:gravity="center"
android:layout_centerHorizontal="true"
android:background="@drawable/test"
android:text="sdsjhdsd" />
</RelativeLayout>
</LinearLayout>
android:background="@drawable/ic_dot"
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:bottomLeftRadius="100dp"
android:bottomRightRadius="100dp"
android:topLeftRadius="100dp"
android:topRightRadius="100dp" />
<solid android:color="@color/lightWhite" />
<size
android:width="100dp"
android:height="100dp" />
<stroke
android:width="3dp"
android:color="#22ff00" />
</shape>
android:background="@drawable/test"
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#e60707" />
<corners android:radius="50dp" />
</shape>
结果
我正在尝试创建一个底部有矩形的圆形文本视图以供参考我在这里分享示例图像并编写我想要实现的代码
任何人都可以帮助我创建以下屏幕截图,在此先感谢。
试试这个
<?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:background="#ff0"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/myTv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@drawable/ic_dot"
android:gravity="center"
android:padding="10dp"
android:text="sdsjhdsd"
android:textColor="#ff00" />
<TextView
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/myTv"
android:gravity="center"
android:layout_centerHorizontal="true"
android:background="@drawable/test"
android:text="sdsjhdsd" />
</RelativeLayout>
</LinearLayout>
android:background="@drawable/ic_dot"
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners
android:bottomLeftRadius="100dp"
android:bottomRightRadius="100dp"
android:topLeftRadius="100dp"
android:topRightRadius="100dp" />
<solid android:color="@color/lightWhite" />
<size
android:width="100dp"
android:height="100dp" />
<stroke
android:width="3dp"
android:color="#22ff00" />
</shape>
android:background="@drawable/test"
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#e60707" />
<corners android:radius="50dp" />
</shape>
结果