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對您有所幫助!
嘗試將'clickable'和'focusable'和'focusableInTouchMode'設置爲您的項目佈局爲'false'。雖然 - 你是否設置了「OnClickListener」而不是「OnListItemClick」? –
滾動是什麼意思?滾動項目或滾動到PTR?向上或向下滾動整個ListView?您的設備的觸摸硬件是否正常?您可以在開發人員選項中打開觸摸顯示,以查看設備是否抓住您的手勢並觸摸屏幕的底部。 – Stan
我的意思是,只有在我的手指位於列表的第一個或第二個項目的情況下,才能使整個列表滾動。如果我嘗試在屏幕中間滾動,它不會開始移動。 @Petrov Dmitrii:我現在就試試。 –