Android 单击ListView中ScrollView包装的项目

Android 单击ListView中ScrollView包装的项目,android,android-layout,listview,layout,android-listview,Android,Android Layout,Listview,Layout,Android Listview,我试图在布局中结合图像和文本。我在scrollview中创建布局,scrollview本身在ListView中。 它显示文本可以滚动,因为有长文本和问题解决。但当我尝试单击listview中的项目时,出现了新的问题。 看起来无法单击它。因为当我删除包装文本的scrollview时,它可以为其中的项调用侦听器事件 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.a

我试图在布局中结合图像和文本。我在scrollview中创建布局,scrollview本身在ListView中。 它显示文本可以滚动,因为有长文本和问题解决。但当我尝试单击listview中的项目时,出现了新的问题。 看起来无法单击它。因为当我删除包装文本的scrollview时,它可以为其中的项调用侦听器事件

<?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="wrap_content"
android:orientation="horizontal"   
android:background="@color/hijau_tua"    
 >

<ImageView 
        android:id="@+id/flag"
        android:layout_width="125dp"
        android:layout_height="80dp"
        android:layout_gravity="top"
        />

<ScrollView
    android:layout_width="match_parent"
        android:layout_height="match_parent"
    >
    <LinearLayout 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"            
        >    

        <TextView 
            android:id="@+id/txt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/white"
            android:textSize="15dp"             
        />          

        <TextView 
            android:id="@+id/cur"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="@color/white"
            android:textSize="12dp"        
        />

    </LinearLayout>
    </ScrollView>
这是显示图像和文本视图的布局。我将它包装在ScrollView中的TextView中。 尽管如此,我还是点击了其中一项,没有回应

请告诉我这个问题。
谢谢

下面的链接中给出了listview项目中的Scrollview示例,请点击此链接。 它将帮助你如何实现scrollview scroll InDie listview

这是链接:


我也有同样的问题。ScrollView中的ListView有许多修复程序。问题是它们不执行单击子对象。唯一适合我的解决方案是将ScrollView替换为:

公共类VerticalScrollview扩展了ScrollView{

public VerticalScrollview(Context context) {
    super(context);
}

 public VerticalScrollview(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public VerticalScrollview(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
    final int action = ev.getAction();
    switch (action)
    {
        case MotionEvent.ACTION_DOWN:
                Log.i("VerticalScrollview", "onInterceptTouchEvent: DOWN super false" );
                super.onTouchEvent(ev);
                break;

        case MotionEvent.ACTION_MOVE:
                return false; // redirect MotionEvents to ourself

        case MotionEvent.ACTION_CANCEL:
                Log.i("VerticalScrollview", "onInterceptTouchEvent: CANCEL super false" );
                super.onTouchEvent(ev);
                break;

        case MotionEvent.ACTION_UP:
                Log.i("VerticalScrollview", "onInterceptTouchEvent: UP super false" );
                return false;

        default: Log.i("VerticalScrollview", "onInterceptTouchEvent: " + action ); break;
    }

    return false;
}

@Override
public boolean onTouchEvent(MotionEvent ev) {
    super.onTouchEvent(ev);
    Log.i("VerticalScrollview", "onTouchEvent. action: " + ev.getAction() );
     return true;
}

}

您的意思是上面的布局是listview中的行吗?也许这有助于:^这就是工作。但它只在我触摸图像时起作用。但当我触摸包装在ScrollView中的LinearLayout时,它不起作用。您的链接根本没有帮助。