- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
当使用 9 补丁图像作为背景时,填充似乎总是来自 9 补丁图像。即使您不在 9 补丁图像中使用填充条,它也会使用可绘制对象。
If the padding lines are not included, Android uses the left and top lines to define this drawable area.
http://developer.android.com/guide/topics/graphics/2d-graphics.html#nine-patch
但是您可以使用 android:padding=0dp 或 =Xdp 在 XML 中覆盖它。不幸的是,使用 android:paddingLeft=Xdp 不起作用。所以你被统一填充困住了。我试过这样做:
android:padding="2dp"
android:paddingLeft="20dp"
它对左边的填充没有影响。将它们放在 styles.xml 中会产生类似的结果。
我见过的唯一解决这个问题的技巧是在代码中设置填充。
最佳答案
如果 (android:padding presented) 它覆盖所有其他填充值else if (android:paddingXXX presented) 它覆盖 bg drawable paddingXXX (XXX = Left|Right|Top|Bottom)else if (view has drawable bg) padding values from this drawable (nine-patch in your case) 将被使用否则将应用默认填充(通常为零)
所以不要使用 android:padding="2dp"。填充属性覆盖一切。只需使用 paddingLeft = 20dp、paddingTop = 2dp、paddingRight = 2dp、paddingBottom = 2dp。
或者您可以设置 paddingLeft = 20dp,其他填充值将从 bg drawable 中获取。
关于Android 在一侧的 XML 中覆盖 9 补丁填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14095170/
这可能是一个愚蠢的问题,但是要求图中顶点的最小集合的规范问题是什么,以便从这些顶点开始,所有其他顶点都可以通过“旅行”不超过一条边到达? 现实生活中的应用是:我需要认识哪些人,才能与地球上的其他人仅通
当浏览器在伪元素溢出并导致问题后调整绝对定位大小时。我正在寻找解决此问题的方法。只需调整浏览器大小,直到出现标题文本。 这是问题的演示:http://codepen.io/anon/pen/grKNo
我编写的 java 应用程序遇到了导致硬件性能问题的问题。问题(我相当确定)是我运行该应用程序的一些机器只有 1GB 内存。当我启动 java 应用程序时,我将堆大小设置为 -Xms 512m -Xm
Article 与 Medium 具有单向 ManyToOne 关系,它与下面的代码配合良好:保存和删除文章成功。 我想知道 JPA 是否有一种优雅的方式来删除最后一个子实体(在本例中为medium)
我想弄清楚如何在我的预约表格中将医生列表作为radio_buttons。现在,如果我使用“f.input :physician_id, :as => :radio_buttons”,我会得到一个“是/
我是一名优秀的程序员,十分优秀!