2013-07-20 27 views
0

我在我的應用程序中使用的匹配父佈局的進度條。問題是背景中的按鈕在進度條運行時仍然可點擊。它們不應該是可點擊的,所以我如何讓它們不可點擊。佈局是:Android的掩蔽佈局與其他佈局

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@color/black_with_fifty_percent_alpha" 
    android:gravity="center" 
    android:orientation="vertical" > 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@android:color/white" 
     android:gravity="center_horizontal" 
     android:orientation="vertical" > 

    <ProgressBar 
     style="?android:attr/progressBarStyleLarge" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/text_tv_progress_bar_bultenler" 
     android:textAppearance="?android:attr/textAppearanceMedium" /> 

    </LinearLayout> 

</LinearLayout> 
+0

setClickable(布爾)不工作? – pskink

回答

0

試一下這個設置到此佈局:

OnTouchListener listener = new OnTouchListener() { 
      @Override 
      public boolean onTouch(View v, MotionEvent event) { 
       return true;//consume the touch event 
      } 
     }; 
    yourLayout.setOnTouchListener(listener); 
+0

「setClickable」的方法可能有效,也設置觸摸監聽器是一個解決方案,但我不想要這些,我想知道是否有像一個簡單的解決方案:在XML佈局文件「機器人maskBackground」。 – ismailarilik

+0

據我所知,不.. – kvh