0

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. 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. Is this possible? Something like ImageView.setClickable(false) or layering in Photoshop.

Chain Cross
  • 351
  • 1
  • 2
  • 12
  • 2
    Why not attaching a click listener directly on the `ImageView`? Your view hierarchy will be simpler. – Wang Mar 14 '19 at 18:54
  • May be you should have a look at this answer: https://stackoverflow.com/questions/2283444/android-image-button it can solve your problem by integrating the image directly to the button itself. – olibiaz Mar 14 '19 at 18:55
  • Those aren't what i'm trying to achieve. There's a lot of workaround for this but what i'm trying to achieve is to be able to access a view below a view, ignoring the view above it. – Chain Cross Mar 14 '19 at 18:59

1 Answers1

0

Is there a specific reason why the button can't be on top of the ImageView? If the reason is that the button should not be visible, you could set its background to @android:color/transparent.

Alternatively, have you seen this question?

gpunto
  • 2,573
  • 1
  • 14
  • 17