我刚刚注意到 Button 和 ImageButton 的边框看起来不同。 ImageButton 是完全平坦的。我无法解释它,我希望将 ImageButton 作为“3d-ish”作为默认按钮。欢迎任何想法!
这是我的 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>
提前致谢! 托马斯
最佳答案
Button
在 Material 主题下具有默认标高(实际上,它有一个 StateListAnimator
,在启用按钮时提供标高),而 ImageButton
则没有。
关于android - Button 和 ImageButton 的外观差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33682937/