如何设置属性的onClick为滚动型? [英] How can I set attribute onClick to a ScrollView?
本文介绍了如何设置属性的onClick为滚动型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下布局
<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>
有时滚动型
太小,不会填满整个屏幕,但仍想调用的方法 toQuestion()
点击任意位置在屏幕上。
Sometimes the ScrollView
is too small and won't fill the whole screen but still I want to call the method toQuestion()
clicking anywhere on the screen.
我试过设置的android:layout_height =WRAP_CONTENT
到的LinearLayout
和 Android的:的onClick =toQuestion
到滚动型
但同样的结果。
I've tried setting android:layout_height="wrap_content"
to the LinearLayout
and android:onClick="toQuestion"
to the ScrollView
but same result.
推荐答案
您可以尝试让的LinearLayout
实施的onClick
属性,然后设置:
You could try to let the LinearLayout
implement the onClick
attribute and then set:
android:fillViewport="true"
到滚动型
。
这篇关于如何设置属性的onClick为滚动型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文