2012-02-09 51 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

相關問題