2013-12-12 4 views
0

Я пытаюсь отобразить вид на другую точку зрения в моем макете и в то же время отключить вид, который находится в задней части ...Отключить весь вид дерево

Вот несколько скриншотов, чтобы лучше понять мою просьбу:

Here is the first view

and the semitransparent view that goes over the top.

Проблема я все еще могу нажать на редактирование текстовых полей в представлении обратно.

Вот мой XML код:

<?xml version="1.0" encoding="utf-8"?> 

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/login_parent_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/bg_body" 
    android:orientation="vertical"> 

    <ImageView 
     android:id="@+id/kitu_logo" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_gravity="center" 
     android:padding="@dimen/login_logo_padding" 
     android:src="@drawable/login_logo" /> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_centerInParent="true" 
     android:orientation="vertical"> 

     <ro.gebs.kitu.ui.custom.views.CustomFontEditText 
      android:id="@+id/email_text" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="@dimen/default_margin" 
      android:layout_marginRight="@dimen/default_margin" 
      android:layout_marginTop="@dimen/default_margin" 
      android:background="@drawable/white_shape_border" 
      android:hint="@string/email_hint" 
      android:inputType="textEmailAddress" 
      android:padding="@dimen/edit_text_padding" /> 

     <ro.gebs.kitu.ui.custom.views.CustomFontEditText 
      android:id="@+id/password_text" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="@dimen/default_margin" 
      android:layout_marginLeft="@dimen/default_margin" 
      android:layout_marginRight="@dimen/default_margin" 
      android:background="@drawable/white_shape_no_top_border" 
      android:hint="@string/password_hint" 
      android:inputType="textPassword" 
      android:padding="@dimen/edit_text_padding" /> 

     <ro.gebs.kitu.ui.custom.views.CustomFontButton 
      android:id="@+id/login_btn" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="@dimen/default_margin" 
      android:layout_marginLeft="@dimen/default_margin" 
      android:layout_marginRight="@dimen/default_margin" 
      android:background="@drawable/custom_button" 
      android:gravity="center" 
      android:padding="@dimen/default_padding" 
      android:text="@string/login" 
      android:textColor="@android:color/white" 
      android:textSize="20sp" /> 

     <ro.gebs.kitu.ui.custom.views.CustomFontTextView 
      android:id="@+id/forgot_pass" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginBottom="@dimen/default_margin" 
      android:layout_marginLeft="@dimen/default_margin" 
      android:layout_marginRight="@dimen/default_margin" 
      android:gravity="center" 
      android:text="@string/forgot_password" 
      android:textColor="@color/purple_white_selector" 
      android:textSize="17sp" /> 
    </LinearLayout> 


    <ro.gebs.kitu.ui.custom.views.CustomFontButton 
     android:id="@+id/register_btn" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_marginBottom="@dimen/default_margin" 
     android:layout_marginLeft="@dimen/default_margin" 
     android:layout_marginRight="@dimen/default_margin" 
     android:background="@drawable/custom_register_btn" 
     android:gravity="center" 
     android:padding="@dimen/default_padding" 
     android:text="@string/register" 
     android:textColor="@color/register_text_color" 
     android:textSize="20sp" /> 

    <RelativeLayout 
     android:id="@+id/loading_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/loading_backgroud" 
     android:visibility="gone"> 

     <ImageView 
      android:id="@+id/yellow_wheel" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" 

      android:src="@drawable/loading_yellow" /> 
    </RelativeLayout> 

    <RelativeLayout 
     android:id="@+id/incorrect_email_password_layout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@color/loading_backgroud" 
     android:visibility="gone"> 

     <ro.gebs.kitu.ui.custom.views.CustomFontTextView 
      android:id="@+id/popup_message" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" 
      android:layout_marginLeft="@dimen/default_margin" 
      android:layout_marginRight="@dimen/default_margin" 
      android:layout_marginBottom="10dp" 
      android:gravity="center" 
      android:text="@string/noInternetConnection" 
      android:textColor="#FFFF00" 
      android:textSize="20sp" /> 

     <ro.gebs.kitu.ui.custom.views.CustomFontButton 
      android:id="@+id/dismiss_btn" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/popup_message" 
      android:layout_centerInParent="true" 
      android:layout_marginTop="20dp" 
      android:background="@drawable/custom_dismiss_btn" 
      android:gravity="center" 
      android:paddingBottom="@dimen/default_padding" 
      android:paddingLeft="30dp" 
      android:paddingRight="30dp" 
      android:paddingTop="@dimen/default_padding" 
      android:text="@string/ok" 
      android:textColor="@android:color/white" 
      android:textSize="20sp" /> 

    </RelativeLayout> 
</RelativeLayout> 

и здесь я пытаюсь отключить вид сзади:

parentLayout.setEnabled(false); 

где parentLayout инициализируется здесь:

@Override 
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 
     final View view = inflater.inflate(R.layout.login_fragment, container, false); 
     parentLayout = (RelativeLayout) view; 
     initView(view); 
     return view; 
    } 

ответ

1

Вы не делаете необходимо использовать view.setEnabled (false). Вы можете просто установить onTouchListener на верхний слой, а в функции обратного вызова метода onTouch всегда возвращать true.

В этом случае ваше событие касания не «вернется» к виду сзади.

0

Вы должны установить корневой режим, не настраиваемый, вызывая следующие методы.

view.setFocusable(false); 

view.setFocusableInTouchMode(false); 

view относится к вашей настраиваемой странице входа.

Надеюсь, это поможет.

Смежные вопросы