Button 和 ImageButton 的外观差异
Difference in appearance of Button and ImageButton
我刚刚注意到 Button 和 ImageButton 的边框看起来不一样。 ImageButton 是完全扁平的。我无法解释它,我希望将 ImageButton 作为“3d-ish”作为默认按钮。欢迎任何想法!
这是我的 xml-code
<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 平板电脑上的样子:
提前致谢!
托马斯
Button
在 Material 主题下有默认高度(实际上,它有一个 StateListAnimator
在启用按钮时提供高度),而 ImageButton
没有.
我刚刚注意到 Button 和 ImageButton 的边框看起来不一样。 ImageButton 是完全扁平的。我无法解释它,我希望将 ImageButton 作为“3d-ish”作为默认按钮。欢迎任何想法!
这是我的 xml-code
<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 平板电脑上的样子:
提前致谢! 托马斯
Button
在 Material 主题下有默认高度(实际上,它有一个 StateListAnimator
在启用按钮时提供高度),而 ImageButton
没有.