我想添加一個頁腳到卡片視圖。添加一條水平線和一些帶有底部文字的圖標,如Facebook
在RecyclerView我目前的XML佈局是這樣的:
(此XML代碼的行爲,如RecyclerView行)
代碼:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout 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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.CardView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="@dimen/activity_margin_half"
app:cardBackgroundColor="@color/placeholder_grey"
app:cardCornerRadius="6dp"
app:cardPreventCornerOverlap="false">
<ProgressBar
android:id="@+id/movie_progress"
style="@style/Widget.AppCompat.ProgressBar"
android:layout_width="@dimen/activity_margin"
android:layout_height="@dimen/activity_margin"
android:layout_gravity="center"
android:theme="@style/CircularProgress"/>
<ImageView
android:id="@+id/movie_poster"
android:layout_width="@dimen/poster_thumb_width"
android:layout_height="@dimen/poster_thumb_height"/>
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:layout_marginTop="@dimen/activity_margin"
android:background="@drawable/bg_round_rect"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_margin"
android:paddingEnd="@dimen/activity_margin"
android:paddingLeft="@dimen/poster_thumb_width"
android:paddingRight="@dimen/activity_margin"
android:paddingStart="@dimen/poster_thumb_width"
android:paddingTop="@dimen/activity_margin_half">
<TextView
android:id="@+id/movie_year"
style="@style/TextAppearance.AppCompat.Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_margin_content"
android:layout_marginStart="@dimen/activity_margin_content"
android:alpha="0.38"
android:gravity="start"
android:maxLines="1"
android:textStyle="bold"
android:textColor="#f14e4e"
tools:text="2009 | EN"/>
<TextView
android:id="@+id/movie_title"
style="@style/TextAppearance.AppCompat.Subhead"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_margin_content"
android:layout_marginStart="@dimen/activity_margin_content"
android:layout_marginTop="@dimen/activity_margin_quarter"
android:textColor="#9b92b3"
android:maxLines="1"
tools:text="Movie Title"/>
<TextView
android:id="@+id/movie_desc"
style="@style/TextAppearance.AppCompat.Caption"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/activity_margin_content"
android:layout_marginStart="@dimen/activity_margin_content"
android:layout_marginTop="@dimen/activity_margin_half"
android:ellipsize="end"
android:maxLines="2"
android:textColor="#9b92b3"
tools:text="Nowadays, user engagement is considered one of the most important metrics for the success of your app"/>
</LinearLayout>
</FrameLayout>
現在我想添加更多的東西這個碼。
我想添加一條水平線。 (我想我必須查看)和一些圖標與文字像這樣的畫面:
我該怎麼辦呢?
見我的回答如下。我爲您的預期設計添加了兩個xmls。希望這會解決你的問題。 – FAT