[英]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"/>
and in active.xml
并在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>
I have a custom VerticalTextView
. 我有一个自定义VerticalTextView
。 I want to set this text to my Button in xml. 我想将此文本设置为xml中的Button。 How is that done? 怎么做?
A string is a string in the resources and can be used by ANY VIEW this is a BIG HINT . 字符串是资源中的字符串, 任何视图都可以使用,这是一个大提示 。
Explanation 说明
android:text="@layout/active"
Ideally, this should be: 理想情况下,应为:
android:text="@string/myText"
Of course myText
should be in your strings.xml 当然myText
应该在您的strings.xml中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.