Textview填充可用宽度

时间:2016-10-17 11:03:34

标签: android android-layout textview

我在相对布局中有两个textview。第一个textview大小是固定的,第二个textview大小是动态的。我希望我的第二个textview填充所有可用宽度want output like this,但我无法执行此操作。可能吗? this is what i am getting right now

我的xml:

 <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/ten_dp">

        <com.staff_have_says.utitlies.MyTextViewBold
            android:id="@+id/banner"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Massage To Management"
            android:background="@android:color/holo_green_dark"
            android:padding="@dimen/ten_dp"
            android:textColor="@color/white"
         />

        <TextView

            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toEndOf="@id/banner"
            android:text="Flaticon Basic License. It's necessary to credit the author.  How to credit the authorship of the icons?Flaticon Basic License. It's necessary to credit the author.  How to credit the authorship of the icons?"

            />
    </RelativeLayout>

1 个答案:

答案 0 :(得分:2)

您可以对内容的两个部分TextView使用SpannableString作为文本。请参阅example