0
我已閱讀Andorid指標和網格(http://developer.android.com/design/style/metrics-grids.html),現在即時嘗試讓我的佈局看起來不錯。 我有兩個元素TextEdit和按鈕的TableRow。TableRow中的Android按鈕大小
<TableRow android:id="@+id/tableRow2" android:layout_width="match_parent" android:layout_height="match_parent">
<EditText
android:id="@+id/personDOB"
android:hint="Date of birth"
android:inputType="date" />
<ImageButton
android:id="@+id/openCalendar"
android:layout_width="48dp"
android:layout_height="wrap_content"
android:background="@drawable/mybutton_background"
android:contentDescription="@string/selectdate"
android:cropToPadding="true"
android:onClick="selectDate"
android:src="@drawable/ic_datepicker"/>
</TableRow>
我的按鈕是32×32(因此我可以添加餘量8DP每側48dp rhytm),但在它的TableRow就像3倍的寬度。 我試着做按鈕layout_width = 48dp(如上),包裝內容,做一些實驗的重量,但這一切都沒有幫助。 我需要按鈕是固定的大小,EditText必須使用所有其他行空間。
正如我上面提到,寬度+重PARAMS沒有幫助這裏(我嘗試不同的PARAMS兩種文本編輯和ImageButton的) - 我的按鈕還是很大 –
@eXeLe,你爲什麼採取'高度= wrap_content' ? –
我爲什麼要改變它?它工作,因爲我需要在這裏。 –