我的Scrollview没有使用LinearLayout android滚动
任何想法为什么?如果是这样请回复,我最近开始使用android所以它可能是非常简单的事情。但我搜索并无法修复它。帮助将很高兴。
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:nestedScrollingEnabled="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:id="@+id/textView"
android:layout_gravity="center_horizontal"
android:paddingBottom="80dp"/>
<android.support.v7.widget.CardView
android:layout_width="375dp"
android:layout_height="300dp"
android:layout_gravity="center_horizontal"
app:cardCornerRadius="0dp"
app:cardElevation="3dp"
app:cardBackgroundColor="#161616">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/image"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
</LinearLayout>
</ScrollView>
答案 0 :(得分:1)
查看布局,纵向可能没有足够的内容甚至需要滚动视图。我把它插入到Android Studio中,只能在风景中滚动。
此外,作为一般规则, struct S {
char bytes; // only difference
uint64_t t;
};
// .... (the same as above)
(您的ScrollView
)的孩子应使用LinearLayout
代替wrap_content
。
如果您希望match_parent
始终至少填满整个屏幕,可以使用ScrollView
上的android:fillViewPort="true"
属性。
答案 1 :(得分:0)
您不能将可滚动视图(cardView)放在另一个可滚动视图(LinearLayout)中,因为两个滚动都不兼容。
如果你只有一个TextView上面的CardView,我会删除ScrollView,然后CardView将正常滚动。布局结构应为:
<LinearLayout>
<TextView>
<Cardview>
...
</CardView>
</LinearLayout>
希望它有所帮助。