- <h1>GuideView</h1>
- 本系统能够快速的为一个Activity里的任何一个View控件创建一个卡片式的布局。</p>
- <h3>工作原理</h3>
-
<h3>usage</h3>
<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"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="6dp"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="@android:color/white"
app:cardPreventCornerOverlap="false"
app:cardUseCompatPadding="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"><TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="热门回答" android:textColor="#9c9c9c" android:textSize="13sp"/> <TextView android:id="@+id/tv_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8dp" android:layout_marginTop="8dp" android:text="热门回答" android:textColor="@android:color/black" android:textSize="16sp"/> <TextView android:id="@+id/tv_content" android:text="热门回答" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> </android.support.v7.widget.CardView>
-
<?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView android:id="@+id/home_item_root_view" 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" app:cardCornerRadius="2dp" app:cardElevation="0dp"> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?android:attr/itemBackground" android:orientation="vertical"> <ImageView android:id="@+id/iv_news_summary_photo" android:layout_width="72dp" android:layout_height="72dp" android:layout_margin="4dp" android:scaleType="centerCrop" android:transitionName="photos" tools:src="@drawable/ic_header"/> <TextView android:id="@+id/tv_news_summary_title" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignTop="@+id/iv_news_summary_photo" android:layout_toRightOf="@+id/iv_news_summary_photo" android:gravity="center_vertical" android:singleLine="true" android:textAppearance="@style/TextAppearance.AppCompat.Subhead" android:textColor="?android:attr/textColorPrimary" tools:text="中石油:美国油价便宜因不含税"/> <TextView android:id="@+id/tv_news_summary_digest" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignBottom="@+id/iv_news_summary_photo" android:layout_alignLeft="@+id/tv_news_summary_title" android:layout_below="@+id/tv_news_summary_title" android:layout_marginTop="2dp" android:ellipsize="end" android:lines="2" android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="?android:attr/textColorPrimary" tools:text="中国油价的48%交税了,美国价税分离,价是价,税是税。"/> <TextView android:id="@+id/tv_news_summary_ptime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/iv_news_summary_photo" android:layout_alignParentRight="true" android:layout_marginRight="8dp" android:textAppearance="@style/TextAppearance.AppCompat.Small" android:textColor="?android:attr/textColorSecondary" android:textSize="12sp" tools:text="2016-02-19 08:09:19"/> </RelativeLayout> </android.support.v7.widget.CardView>
-
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
android:id="@+id/home_item_root_view"
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="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
app:cardCornerRadius="2dp"
app:cardElevation="0dp"><LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="?android:attr/itemBackground" android:orientation="vertical"> <ImageView android:id="@+id/iv_photo_summary" android:layout_width="200dp" android:layout_height="200dp" android:layout_marginLeft="2dp" android:layout_marginRight="2dp" android:layout_marginTop="2dp" android:scaleType="centerCrop" android:transitionName="photos" tools:src="@drawable/ic_header"/> <TextView android:id="@+id/tv_photo_summary" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center" android:padding="8dp" android:textAppearance="@style/TextAppearance.AppCompat.Caption" android:textColor="?android:attr/textColorSecondary" tools:text="近日,在网上爆红的少女组合Sunshine通过官方微博发布一组唯美风格写真。"/> </LinearLayout> </android.support.v7.widget.CardView>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:background="@drawable/item_selector"
android:orientation="vertical"
android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp">
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:text="Title"
android:textColor="#333333"
android:textSize="16sp"
android:textStyle="bold"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:baselineAligned="true"
android:orientation="horizontal">
<ImageView
android:id="@+id/image"
android:layout_width="100dp"
android:layout_height="60dp"
android:contentDescription="@string/app_name"
android:src="@drawable/app_icon"
android:visibility="visible"/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp">
<TextView
android:id="@+id/content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="top"
android:maxLines="2"
android:text="content"
android:textColor="#999999"
android:textSize="13sp"/>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:singleLine="true"
android:text="date"
android:textSize="12sp"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>