[英]How to set custom text for a button in Android?
<Button android:id="@+id/AdultLeft1"
android:layout_width="40dip" android:text="@layout/active"
android:layout_marginTop="110dip" android:layout_height="wrap_content"
android:background="@drawable/notselectedtabright_landscape"
android:focusable="false"/>
並在active.xml
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"android:layout_width="fill_parent"
android:layout_height="wrap_content">
<com.xxx.VerticalTextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/black"
android:textStyle="bold"android:textSize="12dip"
android:text="Closed\nCases"/>
</RelativeLayout>
我有一個自定義VerticalTextView
。 我想將此文本設置為xml中的Button。 怎么做?
字符串是資源中的字符串, 任何視圖都可以使用,這是一個大提示 。
說明
android:text="@layout/active"
理想情況下,應為:
android:text="@string/myText"
當然myText
應該在您的strings.xml中
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.