Reputation:
CardView
has beautiful structure and I like it. But for GridView
as an CardView
I must be using a nine patch background to have a structure like I have with the CardView
.
Can I simply use CardView
structure as an GridView
? In CardView
after rotate screen we have full width but I want to separator like with GridView
.
How to create
CardView
as an GridView
structure;GridView
like with CardView
.Can I do one of those items?
Upvotes: 2
Views: 7670
Reputation: 2040
my logic:
card_item.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:card_view="http://schemas.android.com/apk/res-auto" >
<!-- A CardView that contains a TextView -->
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_gravity="center"
android:layout_width="200dp"
android:layout_height="200dp"
card_view:cardCornerRadius="4dp">
<TextView
android:id="@+id/info_text"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v7.widget.CardView>
</LinearLayout>
gridview_item.xml:
<!-- A RecyclerView with some commonly used attributes -->
<android.support.v7.widget.RecyclerView
android:id="@+id/my_recycler_view"
android:scrollbars="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Upvotes: 2