我正在設計一個計算器應用程序,我需要一些「少」重要的按鈕來縮小。我有一個LinearLayout,我已經將按鈕的高度設置爲16dp。我也將字體設置爲10sp,但如果我不包含wrap_content,文本將不顯示。如何在android上使用小按鈕並仍然顯示文本?
我也讀過關於填充可能是一個問題,我已經確保它等於零。
無論如何有一個小按鈕,仍然顯示文本嗎?
按鈕的代碼:
<Button
android:id="@+id/SIN"
android:layout_width="fill_parent"
android:layout_height="16dp"
android:layout_marginBottom="@dimen/button_marg"
android:layout_marginLeft="@dimen/button_marg"
android:layout_marginRight="@dimen/button_marg"
android:layout_marginTop="@dimen/button_marg"
android:background="@drawable/keypad1"
android:minHeight="12dp"
android:minWidth="0dp"
android:onClick="onClick"
android:text="sin"
android:textSize="@dimen/spec_button_text_size" />
謝謝!解決了問題!我已經在背景文件「keypad1」中設置了所有方向的填充0,但這並沒有幫助。 – Euklides 2013-04-21 18:22:12
有一個默認的填充..這需要在按鈕內的空間..這就是爲什麼我改變爲0dp ..很高興知道你的問題解決了:) – stinepike 2013-04-21 18:23:25