本文介绍了为什么我的列表视图不滚动?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:removed="@drawable/bg">
<ScrollView
android:id="@+id/scrollView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tvSchemeName"
android:layout_width="match_parent"
android:layout_height="wrap_removed"
android:gravity="center"
android:textColor="#FFFFFF"
android:removed="@drawable/btnbg"
android:text=""
style="@style/TxtStyle"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:layout_gravity="center|top"
android:id="@+id/image"
android:layout_marginTop="0dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_width="match_parent"
android:layout_height="250dp"
android:scaleType="fitCenter"/>
<TextView
android:id="@+id/tvTemp1"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_gravity="center"
android:gravity="center"
android:textColor="#FFFFFF"
android:removed="@drawable/bg2"
android:text="Scheme Details"
style="@style/TxtStyle"
android:textSize="20dp" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:removed="#424A5D"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp">
<TableRow
android:id="@+id/tableRow1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/tvShopName"
android:layout_width="match_parent"
android:layout_height="wrap_removed"
android:layout_margin="10dp"
android:textColor="#ffffff"
android:text=""
style="@style/TxtStyleNosize"
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/tvFloorName"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:textColor="#ffffff"
android:layout_height="wrap_removed"
style="@style/TxtStyleNosize"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/tvStartDate"
android:layout_width="match_parent"
android:layout_height="wrap_removed"
android:textColor="#ffffff"
android:layout_margin="10dp"
style="@style/TxtStyleNosize"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
<TableRow
android:id="@+id/tableRow4"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/tvEndDate"
android:layout_width="match_parent"
android:layout_height="wrap_removed"
android:textColor="#ffffff"
android:layout_margin="10dp"
style="@style/TxtStyleNosize"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
</TableRow>
</TableLayout>
<TextView
android:id="@+id/tvTemp2"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_gravity="center"
android:gravity="center"
android:textColor="#FFFFFF"
android:removed="@drawable/bg2"
android:text="Product List Of This Scheme"
style="@style/TxtStyle"
android:textSize="20dp" />
<ListView
android:id="@+id/lstSchemeProduct"
android:layout_width="match_parent"
android:layout_height="wrap_removed"
android:layout_marginLeft="10dp"
android:layout_weight="3"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
style="@style/TxtStyle" >
</ListView>
</LinearLayout>
</ScrollView>
</LinearLayout>
What I have tried:
i tried removing scroll view but this make activity not scrolling. please suggest me possible solutions.
What I have tried:
i tried removing scroll view but this make activity not scrolling. please suggest me possible solutions.
推荐答案
ListView lv = (ListView) findViewById(R.id.layout_lv);
lv.setOnTouchListener(new OnTouchListener() {
// Setting on Touch Listener for handling the touch inside ScrollView
@Override
public boolean onTouch(View v, MotionEvent event) {
// Disallow the touch request for parent scroll on touch of child view
v.getParent().requestDisallowInterceptTouchEvent(true);
return false;
}
});
这篇关于为什么我的列表视图不滚动?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!