造型的EditText视图形状绘制到类似于新的全息主题为Android< 3.0 [英] Styling EditText view with shape drawable to look similar to new holographic theme for Android < 3.0

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

问题描述

我想创建一个形状绘制以模仿新的全息主题(安卓> = 3.0)在旧的Andr​​oid版本。

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

这是很容易画一条线在底部用

It's quite easy to draw a line at the bottom with

  <?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天全站免登陆