我想创建一个 shape drawable因为它模仿旧 Android 版本上的新全息主题 (Android >=3.0)。
在底部画一条线很容易
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape >
<solid android:color="@color/border" />
</shape>
</item>
<!-- main color -->
<item android:bottom="1.5dp">
<shape >
<solid android:color="@color/background" />
</shape>
</item>
</layer-list>
但是如何在全息主题中左右绘制刻度线
最佳答案
这有点小技巧,但除非你找到更好的东西,否则这种方式应该是可能的。
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape >
<solid android:color="@color/border" />
</shape>
</item>
<!-- main color -->
<item android:bottom="1.5dp"
android:left="1.5dp"
android:right="1.5dp">
<shape >
<solid android:color="@color/background" />
</shape>
</item>
<!-- draw another block to cut-off the left and right bars -->
<item android:bottom="15.0dp">
<shape >
<solid android:color="@color/background" />
</shape>
</item>
</layer-list>
关于android - 为具有可绘制形状的 EditText View 设置样式,使其看起来类似于 Android < 3.0 的新全息主题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8211929/