我有以下布局
<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
但结果相同。
最佳答案
您可以尝试让 LinearLayout
实现 onClick
属性,然后设置:
android:fillViewport="true"
到 ScrollView
。
关于android - 如何将属性 onClick 设置为 ScrollView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10651309/