我剛剛注意到Button和ImageButton的邊框看起來不一樣。 ImageButton完全平坦。我無法解釋它,我想將ImageButton作爲默認按鈕「3d-ish」。任何想法都歡迎!Button和ImageButton的外觀差異
這是我的XML代碼
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Power"
android:id="@+id/button1"
android:layout_gravity="center"
android:layout_weight="0"
android:layout_centerInParent="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/f_light_on"
android:id="@+id/button4"
android:layout_gravity="center"
android:layout_weight="0"
android:layout_centerInParent="true" />
</LinearLayout>
謝謝! 托馬斯
你想要帶邊框的ImageButton? –
你有沒有嘗試添加'風格:機器人:ATTR/buttonStyle' –
它最好在新建文件夾繪製風格,並設置機器人:背景=「@繪製/ your_xml」,以保持一致 – Actiwitty