Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable touch of previous layout

Tags:

android

layout

I've android layout as follows:

<RelativeLayout>

    <Layout
        android:id="@+id/login_fragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:name="com.test.console.LoginFragment"  />

    <Layout
        android:id="@+id/transperent_fragment"
        android:name="com.test.transperentFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/body_texture"
        android:alpha="0.2"> />

</RelativeLayout>

If I touch on transparent layer still login button gets clicked. So how to avoid login button click after touch on transparent layout

If I touch on transparent layer still login button gets clicked. So how to avoid login button click after touch on transparent layout

like image 850
Vishwanath Deshmukh Avatar asked Jan 10 '13 07:01

Vishwanath Deshmukh


1 Answers

There are 2 options to make your bottom layout non clickable:

  1. Make your bottom layer (or button) non clickable by adding attribute android:clickable="false"
  2. Make your top layer clickable by adding attribute android:clickable="true", then touch wouldn't pass to lower layers.

Hope it helps you!

like image 110
Evos Avatar answered Oct 20 '22 20:10

Evos