使用形状可绘制的样式设置 EditText 视图,使其看起来类似于 Android 的新全息主题 <3.0 [英] Styling EditText view with shape drawable to look similar to new holographic theme for Android < 3.0

查看:18
本文介绍了使用形状可绘制的样式设置 EditText 视图,使其看起来类似于 Android 的新全息主题 <3.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个shape drawable因为它模仿旧 Android 版本上的新全息主题 (Android >=3.0).

I want to create a shape drawable for that mimics the new holographic theme (Android >=3.0) on older Android versions.

在底部画一条线很容易

  <?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>

但是如何在全息主题中左右绘制刻度边界

But how to draw the tick boundaries left and right as in the holo theme

推荐答案

这是一个小技巧,但除非你找到更好的东西,否则这种方式应该是可能的.

It's a little hack, but unless you find something better, this way it should be possible.

<?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>

这篇关于使用形状可绘制的样式设置 EditText 视图,使其看起来类似于 Android 的新全息主题 &lt;3.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆