Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 位于文本视图右下角的徽章图标_Android - Fatal编程技术网

Android 位于文本视图右下角的徽章图标

Android 位于文本视图右下角的徽章图标,android,Android,我试图在textview中的文本末尾放置一个徽章,但当我在设备上运行示例时,徽章被包装为textview大小。我希望它位于textviewlength的右下角 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app1="http://schemas.android.com/apk/res/socialbible.reef" xmlns:app="

我试图在
textview
中的文本末尾放置一个徽章,但当我在设备上运行示例时,徽章被包装为
textview
大小。我希望它位于
textview
length的右下角

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app1="http://schemas.android.com/apk/res/socialbible.reef"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@color/white"
        android:clickable="false"
        android:focusable="false"
        android:paddingLeft="@dimen/ten_dp" >

        <TextView
            android:id="@+id/txNumber"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginRight="@dimen/one_dp"
            android:clickable="false"
            android:focusable="false"
            android:text="60"
            android:textColor="@color/black"
            android:textSize="16sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/myButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="false"
            android:layout_toRightOf="@+id/txNumber"
            android:background="@color/transparent"
            android:clickable="false"
            android:focusable="false"
            android:gravity="top"
            android:paddingBottom="@dimen/six_dp"
            android:text="1111111111111111" />

        <TextView
            android:id="@+id/txCommentaires"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/myButton"
            android:layout_alignParentBottom="false"
            android:layout_alignRight="@+id/myButton"
            android:layout_marginLeft="@dimen/ten_dp"
            android:background="@drawable/badge_circle"
            android:clickable="false"
            android:focusable="false"
            android:paddingLeft="@dimen/six_dp"
            android:paddingRight="@dimen/six_dp"
            android:text="10"
            android:textColor="#FFF"
            android:textSize="16sp"
            android:textStyle="bold" />

    </RelativeLayout>

试试这个

<TextView
    android:id="@+id/txCommentaires"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@+id/myButton"
    android:layout_toRightOf="@+id/myButton"
    android:clickable="false"
    android:focusable="false"
    android:background="@drawable/badge_circle"
    android:text="10"
    android:textColor="#FFF"
    android:textSize="16sp"
    android:textStyle="bold" />

我试过了,效果很好

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app1="http://schemas.android.com/apk/res/socialbible.reef"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#FFFFFF"
        android:clickable="false"
        android:focusable="false"
        android:paddingLeft="10dp" >

        <TextView
            android:id="@+id/txNumber"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_marginRight="1dp"
            android:clickable="false"
            android:focusable="false"
            android:text="60"
            android:textColor="#000000"
            android:textSize="16sp"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/myButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="false"
            android:layout_toRightOf="@+id/txNumber"

            android:clickable="false"
            android:focusable="false"
            android:gravity="top"
            android:paddingBottom="6dp"
            android:text="1111111111111111gggggggggggggggggggggggggggggggggggggggghhhhhhhhhhhhhhhhhhhhhhhhhhh" />

        <TextView
            android:id="@+id/txCommentaires"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/myButton"
            android:layout_alignParentBottom="false"
            android:layout_alignRight="@+id/myButton"
            android:layout_marginLeft="10dp"
            android:clickable="false"
            android:focusable="false"
            android:paddingLeft="6dp"
            android:paddingRight="6dp"
            android:text="10"
            android:textColor="#333333"
            android:textSize="16sp"
            android:textStyle="bold" />

    </RelativeLayout>



对于两行或更多行,txCommentaires将不可见。您可以发布您获得的图像吗