我有一个LinearLayout
有几个搜索栏作为孩子,在SeekBars
我使用android:clickable=false
,在LinearLayout上我有android:clickable=true
和相应的{{1}然而,如果setOnClickListenner
上的任何按下都没有触发SeekBars
点击,我已经阅读了它应该在某个地方阅读并通过将LinearLayout
替换为SeekBars
进行测试并将Buttons
属性设置为clickable
,然后将点击冒泡到父级。
我的问题是为什么行为不相似?
编辑:添加了代码示例
布局:
false
的活动:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context=".MyActivity">
<LinearLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<SeekBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="false"
android:longClickable="false"
android:focusable="false"
/>
<Button
android:layout_marginTop="10dp"
android:clickable="false"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Click me!"/>
</LinearLayout>
答案 0 :(得分:0)
终于明白了你的要求我认为这会解决它。 SeekBar
不可调焦,而Button
是。
这就是您无法从SeekBar
android:focusable="false"
允许此焦点可以使Button
和SeekBar
函数在单击时的功能相同。