【问题标题】:Unwanted card shadow on android 4.2.2android 4.2.2 上不需要的卡阴影
【发布时间】:2017-02-19 22:10:17
【问题描述】:

我实现了一个LisView,它具有嵌套的卡片视图和一个自定义的ImageView 用于阴影。这是布局:

  <android.support.v7.widget.CardView
        android:id="@+id/food_card_view"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="2dp"
        card_view:cardBackgroundColor="@android:color/transparent"
        card_view:cardCornerRadius="0dp"
        card_view:cardElevation="0dp"
        card_view:cardPreventCornerOverlap="false">

(... views here ...)

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

问题在于 CardView 显示在某些设备上具有高度值,即使 card_view:cardElevation="0dp" 设置为 0dp

【问题讨论】:

  • 如果你不想要阴影效果,为什么要使用 CardView?这就是卡片的全部观点
  • 你说得对,我错过了一些步骤啊哈。我的意思是,我首先实现了 RecyclerView,然后由于回收项目的一些问题而更改为 ListView,我没有意识到我可以简单地删除 CardView 并将其替换为正常布局。谢谢;)

标签: android cardview android-elevation


【解决方案1】:

我找到了解决方案,方法是从布局中删除 CardView 并直接膨胀保存项目列表视图的 LinearLayout

【讨论】:

    猜你喜欢
    • 2019-06-14
    • 1970-01-01
    • 2015-01-26
    • 1970-01-01
    • 1970-01-01
    • 2014-07-05
    • 1970-01-01
    • 2011-01-30
    • 1970-01-01
    相关资源
    最近更新 更多