我是Android新手,这是我的第一个问题.
我想在cardview的开头添加彩色垂直边框.我怎样才能在xml上实现它?我尝试用空textview添加它,但它搞乱了整个cardview本身.请查看下面发布的图片链接.
activity_main.xml中
<android.support.v7.widget.CardView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
card_view:contentPadding="16dp"
card_view:cardElevation="2dp"
card_view:cardCornerRadius="5dp">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
style="@style/Base.TextAppearance.AppCompat.Headline"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Title" />
<TextView
style="@style/Base.TextAppearance.AppCompat.Body1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Content here" />
</LinearLayout>
</android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud)
非常感谢
我正在实现卡片视图,但我找不到任何边框选项来设置它的边框.
这是我的card.xml:
<android.support.v7.widget.CardView android:layout_marginTop="10dp"
android:id="@+id/cardView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
card_view:cardPreventCornerOverlap="false"
app:cardPreventCornerOverlap="false"
xmlns:card_view="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<RelativeLayout
android:background="@drawable/tab_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="16dp">
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textSize="20sp" />
</RelativeLayout>
</android.support.v7.widget.CardView>
Run Code Online (Sandbox Code Playgroud)
这是我的图像,我想在卡片视图上实现绿色边框?
帮我.我怎么能实现这个呢?我没有线索.
谢谢.