android - Button 和 ImageButton 的外观差异

标签 android button android-5.0-lollipop imagebutton

我刚刚注意到 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>

这就是它在我的 Lollipop 平板电脑上的外观: enter image description here

提前致谢! 托马斯

最佳答案

Button 在 Material 主题下具有默认标高(实际上,它有一个 StateListAnimator,在启用按钮时提供标高),而 ImageButton 则没有。

关于android - Button 和 ImageButton 的外观差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33682937/

相关文章:

ios - 快速为常规按钮提供条形按钮标识符

javascript - 如何区分浏览器后退/前进按钮?

android 5.0 Material 设计标签

android - 如何在布局xml中添加recyclerview

android - 在android Lollipop 上启动应用程序时强制关闭

android - 寻找多平台分析解决方案?

安卓工作室 : GC overhead limit exceeded

Android - unregisterReceiver 概念的详细信息?

java - getContext() 不存在

wpf - 如何在 WPF 中更改按钮 MouseOver 的背景?