将清单中的minSdkVersion从10更改为11后,按钮失真.如果我将其更改回10,按钮就可以了.这些按钮在每个可绘制文件夹中都有各自的绘图.这也发生在没有drawable的按钮上.只有文本文本的按钮会变得相当大.
编辑以添加xml示例:
这是xml中的按钮的样子.
<button androID:ID="@+ID/settingsEditInfoBtn" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:background="@drawable/edit_info_btn" />
文本是图像的一部分.这是可绘制的编辑信息按钮.
解决方法:
按钮的minHeight和minWIDth由某个默认主题设置.将它们设置为1dp解决了这种情况下的问题.
<button androID:ID="@+ID/settingsEditInfoBtn" androID:minHeight="1dp" androID:minWIDth="1dp" androID:layout_wIDth="wrap_content" androID:layout_height="wrap_content" androID:background="@drawable/edit_info_btn" />
或者,您可以在应用程序主题中设置按钮样式,以覆盖所有按钮的这些值.在values / themes.xml中:
<style name="Mytheme" parent="androID:theme"> <item name="androID:buttonStyle">@style/MybuttonStyle</item></style><style name="MybuttonStyle" parent="androID:style/Widget.button"> <item name="androID:minHeight">1dp</item> <item name="androID:minWIDth">1dp</item></style>
然后,不要忘记将自定义主题应用于AndroIDManifest.xml中的任何所需活动:
<activity androID:name=".MainActivity" androID:theme="@style/Mytheme"</activity>
总结 以上是内存溢出为你收集整理的android – 在清单中更改minSdkVersion后,按钮被扭曲了全部内容,希望文章能够帮你解决android – 在清单中更改minSdkVersion后,按钮被扭曲了所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)