android - 为具有可绘制形状的 EditText View 设置样式,使其看起来类似于 Android < 3.0 的新全息主题

标签 android background themes android-3.0-honeycomb drawable

我想创建一个 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>

但是如何在全息主题中左右绘制刻度线slide from talk about android ui at Google I/O 2011

最佳答案

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

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

相关文章:

android - 如何禁用 SoftKeyBoard 上的 "input methods"?

javascript - 如何循环播放背景视频并删除控件,同时仍保留我的随机背景视频?

css - ionic 3 动态主题化应用程序

Android 通过验证用户名和密码使用重定向 URL 在 Web View 中查看 .pdf 文件

android - 屏幕上的两个动态 fragment (背面)

android - 使用线性加速度android计算距离

html - 无法居中背景图片

html - 更改 Bootstrap 进度条背景(不是进度条,而是进度条背景)

javascript - 根据深色或浅色模式更改样式

c++ - Windows 7 当前启动/关闭位图