是否可以使用自定義xml佈局創建按鈕?帶自定義XML佈局的按鈕
我有這樣的佈局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="1dp"
android:background="#7e7e7e">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:background="#f9f9f9">
<TextView
android:id="@+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:text="ButtText"
android:textColor="#000000">
</TextView>
<ImageView
android:id="@+id/ImageView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/arrow"
android:layout_alignParentRight="true">
</ImageView>
</RelativeLayout>
</LinearLayout>
現在我想用這個按鈕上。任何人都知道我可以做到這一點?
我在想如果我有擴展Button的Button.java文件。然後setView(R.layout.mylayout.xml); ...但是,這是爲了方便,而這顯然不工作
問候馬丁
一切都很簡單。謝謝你今天的信息! :) – f0rz 2010-02-25 17:26:13