-1
作爲標題,在一個按鈕中,我在背景中設置了一個資源(一個方形圖像)。
問題是,按鈕現在比古典按鈕高得多,我如何使它與其他按鈕一樣高?
我試着用9.patch卻有着相同的結果...
這是9patch文件(只角是很重要的)
按鈕高度與Android中的背景高度不同
按鈕的代碼:
<Button
android:id="@+id/buttonLogIn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/button"
android:text="Log In"
android:textColor="#FFFFFF" />
代碼的資源:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/bottonep" /> <!-- pressed -->
<item android:drawable="@drawable/bottone" /> <!-- default -->
</selector>
提供一些代碼和更多的細節。 –
你試過調整'android:padding =「」'那個'Button'嗎? –
爲什麼我必須把代碼?這只是一張圖片。 (現在我添加布局) 與填充我不知道字體大小有多大 – Lele