【问题标题】:Android Shadow Effect on EditText Field. [duplicate]Android 对 EditText 字段的阴影效果。 [复制]
【发布时间】:2016-04-29 04:40:57
【问题描述】:

【问题讨论】:

标签: android


【解决方案1】:

您可以使用CardView 并设置其高度来创建阴影:

<android.support.v7.widget.CardView 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:cardElevation="4dp">

    <!-- Insert desired views here -->

</android.support.v7.widget.CardView>

请注意,CardView 扩展了 FrameLayout,因此如果有多个子代,它将堆叠其子代。在CardView 中添加LinearLayoutRelativeLayout,并在其中一个视图中添加视图(在您的情况下为EditText)以获得更大的灵活性。

【讨论】:

  • 当我使用 CardView 对象时。它说找不到以下类 - android.support.v7.widget.CardView
  • @AmanAgarwal 您需要将设计支持库添加到模块的 build.gradle 中,例如:compile 'com.android.support:design:23.1.0'。使用您在项目中使用的版本,而不是 23.1.0。
猜你喜欢
  • 2012-06-06
  • 1970-01-01
  • 2011-07-18
  • 1970-01-01
  • 2011-03-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2010-11-10
相关资源
最近更新 更多