1.先看圖,是否是你想要的
2.布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/lin_img"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants"----------------//加上這行
>
<ListView
android:id="@+id/hot_listview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#00000000"
android:listSelector="#00000000"
></ListView>
</LinearLayout>
descendantFocusability屬性的值有三種:
beforeDescendants:viewgroup會優先其子類控件而獲取到焦點
afterDescendants:viewgroup只有當其子類控件不需要獲取焦點時才獲取焦點
blocksDescendants:viewgroup會覆蓋子類控件而直接獲得焦點
子控件設置:android:focusable="false"
---------------------
作者:富貴編程之路
來源:CSDN
原文:https://blog.csdn.net/zcf520android/article/details/51471018
版權聲明:本文為博主原創文章,轉載請附上博文鏈接!