- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我创建了一个 9-patch PNG 但它不起作用。在 Android SDK 工具中,一切看起来都正常。但是当我将它添加到 Button 时,我只看到粉红色的背景。文本放置(补丁中的填充)似乎没问题。我做错了什么?
<Button
android:id="@+id/button_settings"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:text="Settings"
android:textColor="#fff"
android:background="@drawable/button_settings_idle"
/>
Android SDK 工具中的 9-patch:
普通按钮和带有 PNG 的按钮:
我项目中使用的PNG
最佳答案
将你的背景图像画成彩虹(最好是对角渐变),然后你会看到图像的哪一部分重叠,以及可能的原因。
我的猜测:水平修剪您的图片(移除中间部分并让 9patch 完成它的工作)然后看看会发生什么。如果背景图片比实际按钮大,就会发生奇怪的事情 - 比如将“文本区域”重叠在“固定”图像部分上。
关于android - 我的 Button 9 补丁 PNG 有什么问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7714076/
我遇到过这个 html: 上面的html和这个有什么区别: 最佳答案 来自MDN page on the tag : 对于 type 的属性标签,可能的值是: 提交:按钮将表单数据提交给服务器
Button button= (Button) findViewbyID(R.id.button); 和 Button button = new Button(this); 有什么区别? 最佳答案 有
我是一名优秀的程序员,十分优秀!