我有以下布局如何将onClick属性设置为ScrollView?
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white" >
<LinearLayout
android:id="@+id/answerMainFrame"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/white"
android:isScrollContainer="true"
android:onClick="toQuestion" >
<ImageView
android:id="@+id/answer_img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/question_img_cd" />
<TextView
android:id="@+id/answer"
style="@style/Question" />
</LinearLayout>
有时ScrollView
太小,不会填满整个屏幕,但仍想调用的方法toQuestion()
任何地方点击屏幕上。
我试过将android:layout_height="wrap_content"
设置为LinearLayout
和android:onClick="toQuestion"
至ScrollView
但结果相同。
因此您的实际问题是如何总是有整个屏幕点击? [这](http://stackoverflow.com/questions/5648985/ontouchlistener-for-entire-screen)可能会帮助.. – keyser
我认为可能有两个问题,如何让滚动视图填充屏幕以及如何点击时调用该方法 – FabianCook