如何绕过android中textview的一角

Ash*_*sal 14 android android-layout

我想绕过文本视图的唯一一侧,如左上角的圆形和右上角的一轮,我使用此代码.但它不起作用.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

<solid android:color="@color/login_layout" />

<stroke
        android:width="1dp"
        android:color="@color/login_layout" />

<padding
        android:bottom="1dp"
        android:left="1dp"
        android:right="1dp"
        android:top="1dp" />

<corners
        android:bottomLeftRadius="0dip"
        android:bottomRightRadius="0dip"
        android:topLeftRadius="10dip"
        android:topRightRadius="10dip" />

</shape>
Run Code Online (Sandbox Code Playgroud)

Syn*_*ete 8

有时它不会在模拟器和图形布局中显示尝试在真实设备中运行代码并检查


Md *_*fur 6

请尝试这种方式。

texttextshape.xml文件。

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"

    android:shape="rectangle" >

    <solid android:color="#FFFFFF" />
    <corners
        android:bottomLeftRadius="5dp"
        android:bottomRightRadius="5dp"
        android:topLeftRadius="5dp"
        android:topRightRadius="5dp"
         />

</shape>
Run Code Online (Sandbox Code Playgroud)

并设置Text_view android:background =“ @ drawable / texttextshape”

我认为它可以帮助您。


Sub*_*ian 5

更改,

<corners
    android:bottomLeftRadius="0dip"
    android:bottomRightRadius="0dip"
    android:topLeftRadius="10dip"
    android:topRightRadius="10dip" />
Run Code Online (Sandbox Code Playgroud)

<corners
    android:radius="5dip"
    android:bottomLeftRadius="0dip"
    android:bottomRightRadius="0dip"
    android:topLeftRadius="10dip"
    android:topRightRadius="10dip" />
Run Code Online (Sandbox Code Playgroud)

实际上这是android中的一个错误,你必须radius在应用其他半径值之前手动将属性设置为某个随机值.