我有以下佈局如何將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