我有一个 LinearLayout,我想让它看起来像一个按钮。有人建议我将 android:drawable/btn_default
应用为 View 的背景,但这会使 View 看起来像 Android 2.3 按钮。我希望它看起来就像屏幕上的其他按钮一样。我错过了什么?
我的 XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linlay_add_category_area_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="@android:drawable/btn_default"
android:orientation="horizontal"
android:padding="13dp" >
最佳答案
您是否尝试过像这样使用Button
的样式。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="?android:attr/buttonStyle"
android:id="@+id/linlay_add_category_area_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal"
android:padding="13dp">
...
</LinearLayout>
关于android - 如何使用默认的 android Button 可绘制作为另一个 View 的背景?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27537793/