【发布时间】:2016-12-05 05:13:35
【问题描述】:
<RelativeLayout>
<android.support.v7.widget.CardView>
.
.//this card view is showing
.
</android.support.v7.widget.CardView>
<ScrollView>
<RelativeLayout>
<android.support.v7.widget.CardView>
.
.//this card view is not showing
.
</android.support.v7.widget.CardView>
<android.support.v7.widget.RecyclerView>
//data is previewing but not scrolling
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
但是,如果我将第二个卡片视图放在滚动视图之外,那么它就会显示出来。我没明白是什么问题。如果有人可以提供帮助,非常感谢。
我尝试过的解决方案:-
使用nestedscrollview 代替滚动视图。
如果问题格式或样式与 Stack Overflow 指南不匹配,请告诉我,以便我以后以更好的方式提问。而不是投反对票。
编辑:
完整的 XML 文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:id="@+id/goal_status_card"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:textAppearance="@style/Base.TextAppearance.AppCompat.Large"
android:id="@+id/goal_name"
android:textAlignment="center"
android:text="Blood Pressure"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:weightSum="3"
android:orientation="horizontal"
android:id="@+id/goal_brief"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<customView.timeline_segement
android:layout_weight="1"
android:layout_width="100dp"
android:layout_height="wrap_content">
</customView.timeline_segement>
<customView.timeline_segement
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</customView.timeline_segement>
<customView.timeline_segement
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</customView.timeline_segement>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<ScrollView
android:fillViewport="true"
android:layout_below="@+id/goal_status_card"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.CardView
android:layout_margin="@dimen/activity_horizontal_margin"
android:id="@+id/goal_card_team"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:text="Your Care Team"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<LinearLayout
android:weightSum="3"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_weight="1.5"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/doctor_photo"
android:layout_width="wrap_content"
android:layout_height="60dp" />
<TextView
android:textAlignment="center"
android:id="@+id/doctor_name"
android:text="Dr Ankur"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
<ImageView
android:src="@drawable/applozic_ic_action_add"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:orientation="vertical"
android:layout_weight="1.6"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/care_manager_photo"
android:layout_width="wrap_content"
android:layout_height="60dp" />
<TextView
android:textAlignment="center"
android:id="@+id/care_manager_name"
android:text="Cm Ankit"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
<android.support.v7.widget.RecyclerView
android:layout_below="@+id/goal_card_team"
android:id="@+id/action_list"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
</ScrollView>
任何人都可以帮助我吗?
【问题讨论】:
-
在您的启动代码中,将此
<Relative Layout>修复为此<RelativeLayout>,您可以在Relative和Layout之间添加空格。 -
这是拼写错误。我已经修好了。 @Ironman .. 感谢您的指点。
-
现在检查它是否工作??
-
检查不工作。 @铁人
-
在问题中发布您的完整 xml 代码??
标签: android android-recyclerview scrollview android-cardview