简体   繁体   English

Android:专注于视图,就像在photoshop中选择图层一样

[英]Android : Focus on a view much like selecting a layer in photoshop

Say I have the following layout : 说我有以下布局:

<FrameLayout>
    <Button>
    <ImageView
    android:height="match_parent"
    android:width="match_parent"/>
</FrameLayout>

ImageView spans the whole screen and covers the button below it, but I would still like to be able to click the button. ImageView跨越整个屏幕并覆盖其下方的按钮,但我仍然希望能够单击该按钮。 Is this possible? 这可能吗? What I want is to change focus to a certain view, ignoring the view hierarchy. 我想要的是将焦点更改为某个视图,而忽略视图层次结构。 In this case I would like to be able to push the button, ignoring the Imageview above it. 在这种情况下,我希望能够按下按钮,忽略它上面的Imageview。 Is this possible? 这可能吗? Something like ImageView.setClickable(false) or layering in Photoshop. ImageView.setClickable(false)或Photoshop中的分层。

Is there a specific reason why the button can't be on top of the ImageView? 是否有特定原因导致按钮无法位于ImageView之上? If the reason is that the button should not be visible, you could set its background to @android:color/transparent. 如果原因是该按钮不可见,您可以将其背景设置为@android:color / transparent。

Alternatively, have you seen this question ? 或者,你看到这个问题了吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM