2012-02-09 128 views
0
<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如何在Android中为按钮设置自定义文本?

<?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中将此文本设置为我的按钮。这是如何完成的?

+0

检查'/res/values/strings.xml '文件。并请详细解释您确切想要达到的目标。 – Ghost 2012-02-09 06:15:41

+0

需要更多描述。 :) – 2012-02-09 06:17:40

+0

其实我在这里发布的代码其不显示我的代码 – 2012-02-09 06:21:52

回答

0

字符串是资源中的字符串,可以使用任何查看这是一个BIG提示

说明

android:text="@layout/active" 

理想的情况下,这应该是:

android:text="@string/myText" 

当然myText应在strings.xml

+0

你能解释一下我没有收到的例子吗 – 2012-02-09 07:01:55

+0

正如你接受了ans。听起来你懂了。 – OnkarDhane 2012-02-09 07:05:18

+0

你能给我举个例子为我的按钮设置自定义文本 – 2012-02-09 07:36:52

相关问题