2016-06-21 71 views
0

我在SwypeRefreshLayout中使用ListView,滚动仅在View的上部区域中起作用。 我也尝试过其他布局,如LinearLayout,RelativeLayout,并与ScrollView一起工作,但它只滚动列表的前两个元素。 什么错了?Android ListView仅在触摸第一个或第二个列表项时滚动

片段布局:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 
<android.support.v4.widget.SwipeRefreshLayout 
    android:id="@+id/DeviceOverviewRefresher" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
     <ListView 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:drawSelectorOnTop="true" 
      android:divider="@android:color/transparent" 
      android:id="@+id/DeviceOverviewList" /> 
</android.support.v4.widget.SwipeRefreshLayout> 
</LinearLayout> 

ListRowLayout:

<?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:minWidth="25px" 
android:minHeight="25px"> 
<LinearLayout 
    android:id="@+id/Text" 
    android:orientation="vertical" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:paddingLeft="10dp"> 
    <TextView 
     android:text="Text" 
     android:textSize="16dp" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:paddingLeft="60dp" 
     android:id="@+id/DeviceName" /> 
</LinearLayout> 
<ImageView 
    android:id="@+id/Image" 
    android:layout_width="48dp" 
    android:layout_height="48dp" 
    android:padding="1dp" 
    android:src="@drawable/logo" 
    android:layout_alignParentRight="false" /> 
</RelativeLayout> 

THX对您有所帮助!

+0

尝试将'clickable'和'focusable'和'focusableInTouchMode'设置为您的项目布局为'false'。虽然 - 你是否设置了“OnClickListener”而不是“OnListItemClick”? –

+0

滚动是什么意思?滚动项目或滚动到PTR?向上或向下滚动整个ListView?您的设备的触摸硬件是否正常?您可以在开发人员选项中打开触摸显示,以查看设备是否抓住您的手势并触摸屏幕的底部。 – Stan

+0

我的意思是,只有在我的手指位于列表的第一个或第二个项目的情况下,才能使整个列表滚动。如果我尝试在屏幕中间滚动,它不会开始移动。 @Petrov Dmitrii:我现在就试试。 –

回答

0

奇怪,但删除一行代码解决了它。
我刚刚删除了我的“ShowFragment” - 方法中的动画。

var trans = fragmentManager.BeginTransaction(); 
// animation 
//trans.SetCustomAnimations(Resource.Animation.slide_down, Resource.Animation.slide_up); 
相关问题