我是Android应用程序开发的初学者,我想问一下关于卡片布局的非常基本的问题所以我的问题是"我如何在cardView中添加水平滚动视图:
我的卡片布局xml代码如下所示
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:id="@+id/card_view"
cardCornerRadius="12dp"
xmlns="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:orientation="vertical"
android:padding="12dp">
<ImageView
android:layout_width="350dp"
android:layout_height="150dp"
android:elevation="12dp"
android:src="@mipmap/ic_mob1"
tools:ignore="ContentDescription,UnusedAttribute" />
<TextView
android:textColor="#e4000000"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Case for Samsung galaxy C7 pro"
android:textSize="20sp"
tools:ignore="HardcodedText" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Rupee:445"
android:textSize="18sp"
tools:ignore="HardcodedText" />
<RatingBar
android:id="@+id/ratingBar2"
android:layout_width="157dp"
android:layout_height="wrap_content" />
</LinearLayout>
答案 0 :(得分:0)
first of recycalview are use..
then
recycalview adpater xml file in this xml code are used...
<Linearlayout>
// linear oriantation are horizontal
<android.support.v7.widget.CardView>
</android.support.v7.widget.CardView>
</Linearlayout>