【问题标题】:AutoCompleteTextView's item not clickable inside HorizontalScrollView?AutoCompleteTextView 的项目在 Horizo​​ntalScrollView 中不可点击?
【发布时间】:2013-09-05 20:19:17
【问题描述】:

RelativeLayout 周围放置HorizontalScrollView 后,AutoCompleteTextView 正在工作,下拉列表显示,但列表项不可点击。那么有什么我可以改变的吗?

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
<RelativeLayout 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" 
    >

    <ImageView
        android:id="@+id/favicon"
        android:layout_width="20dp"
        android:layout_height="24dp"
        android:layout_marginLeft="4dp"
        android:scaleType="fitXY"
        android:src="@drawable/ic_launcher" 
        android:paddingTop="3dp"
        android:contentDescription="favicon"
        />

    <TextView
        android:id="@+id/text1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="26dp"
        android:text=""
        android:singleLine="true"
        android:ellipsize="end"
        android:textSize="16sp"
        android:textStyle="bold" 

        />

    <TextView
        android:id="@+id/text2"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/text1"
        android:singleLine="true"
        android:ellipsize="end"
        android:textSize="14sp" 
        android:text=""
        android:paddingBottom="3dp"
        />

</RelativeLayout>
</HorizontalScrollView>

我发现了这个问题 TextView is not clickable inside scrollview in listview? 但它不起作用,ontouch 事件没有上升。

【问题讨论】:

  • 不要在问题标题中添加Android,底部的标签绰绰有余。

标签: android


【解决方案1】:

滚动占据你的注意力,添加

"descendantsFocusability:BlocksDesendants" 到你的滚动视图标签

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多