私は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>
感謝
ここでカードビューを使用する必要がありますか?あなたのリサイクラビューにItemDecorationを追加するだけではどうでしょうか? –
私はAndroidの初心者です。私のcurentスキルのために、recyclerviewは少し進んでいます。だから、私はここでcardviewを使用しています。 –
大丈夫、あなたのために解決策を投稿しました –