2012-01-20 67 views
0

我正在創建LinearLayout的過程中,並且在此佈局中...將會有一個選擇菜單。我想知道如何在文本旁邊添加圖標。這是我有以下代碼:菜單選擇圖標/ android

<ImageView 
    android:src="@drawable/ic_launcher" 
    android:layout_width="200dp" 
    android:layout_height="175dp" 
    android:layout_gravity="left" 
<TextView 
    android:text="Check Account" 
    android:textSize="20dp" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="10dp" 
    android:layout_gravity="right"/> 
</ImageView> 

它不是我想要的方式工作。

請幫忙。

回答

2

我不知道你是什麼意思的「選擇菜單」,但如果你想這個文本+圖像是一個可以點擊的選項,你可能想使用正常的button

您可以在文本的頂部/底部/右側/左側添加文本和繪圖,一起形成一個按鈕。

<Button 
    android:id="@+id/groups_button_bg" 
    android:layout_height="wrap_content" 
    android:layout_width="wrap_content" 
    android:text="MenuOption1" 
    android:drawableTop="@drawable/[image]" /> 
+0

哇哦!感謝一束。 – MCarter

+1

耶!得到了接受:) ..但順便說一句,以防萬一你想創建一個「選項/設置/偏好菜單」。看看http://developer.android.com/guide/topics/ui/menus.html –

+0

爲什麼非常感謝你(: – MCarter