在android开发中定义一个普通的Button控件,控件会显示Buttons in button bars should be borderless; use style="?android:attr/buttonBarButtonStyle" (and ?android:attr/buttonBarStyle on the parent)的警告信息。
如下所示:
<Button
android:id="@+id/btnSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txtsave" />
解决办法:
<Button
android:id="@+id/btnSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/buttonStyle"
android:text="@string/txtsave" />
添加上面style="?android:attr/buttonStyle"即可去除警告信息,这个属性有很多,可以根据具体需要进行修改
本文介绍如何在Android开发中解决特定Button控件显示的警告信息。通过添加style属性,可以轻松地消除这一警告,并确保控件样式符合应用的整体设计。

1849

被折叠的 条评论
为什么被折叠?



