【发布时间】:2020-08-08 18:12:35
【问题描述】:
我有cardview,目前看起来像这样。这些cardviews 在list view 内。
我需要这样创作吗?
请问有什么帮助吗?
编辑
感谢 Marsad 和 Zain 的回答。但是,我可以设法得到这个。但是我无法从下面指出的视图中删除形状下的 corner background。
另外,这个视图如何获得玻璃视图?完整的xml 已更新。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout style="@style/clock_item" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools">
<androidx.cardview.widget.CardView
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:card_view="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
card_view:cardBackgroundColor="@android:color/transparent"
card_view:cardElevation="0dp">
<RelativeLayout style="@style/clock_item"
android:background="?android:attr/activatedBackgroundIndicator"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:visibility="gone"
android:layout_marginRight="5dp">
<include layout="@layout/clock_item_merge" />
</RelativeLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<View
android:id="@+id/top_view"
android:layout_width="match_parent"
android:layout_height="100dp"
android:background="@drawable/top_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="20dp"
android:background="#F07971"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/top_view" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/bottom_view"
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="@drawable/bottom_view"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/top_view">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:text="Some Text"
android:textSize="22sp"
android:textStyle="bold"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginEnd="8dp"
android:background="@drawable/icon_nexcloud"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.cardview.widget.CardView>
</RelativeLayout>
【问题讨论】:
标签: android android-layout listview layout android-cardview