2014-09-14 5 views
0

조각이 바뀌는 방식으로 문제가있는 것 같습니다. 조각을 다른 것으로 교체하면 단추/텍스트 필드 등이 여전히 활성화되어 있으며 볼 수는 없지만 화면과 상호 작용하여 해당 단추를 누를 수 있습니다.조각 기능이 교체 된 후에도 계속 남아 있습니다. - 안드로이드 조각

이 문제를 방지하는 방법이 있습니까? 잠재적으로 원래 조각을 숨기고 있습니까? 새로운 FRAGMENT FOR MAIN FRAGMENT

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/contentFragment" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_weight="1" 
android:background="@drawable/white_noise_background" > 

<LinearLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="20dp" 
    android:orientation="vertical" > 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="5dp" 
     android:orientation="horizontal" > 

     <ImageButton 
      android:id="@+id/btnBasketball" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/basketball" /> 

     <ImageButton 
      android:id="@+id/btnSoccer" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/soccer" /> 

     <ImageButton 
      android:id="@+id/btnFootball" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/football" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="1dp" 
     android:layout_margin="10dp" 
     android:background="@color/gray_200" 
     android:orientation="vertical" /> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="5dp" 
     android:orientation="horizontal" > 

     <ImageButton 
      android:id="@+id/btnTennis" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/tennis" /> 

     <ImageButton 
      android:id="@+id/btnVolleyball" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/volleyball" /> 

     <ImageButton 
      android:id="@+id/btnBaseball" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/baseball" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="1dp" 
     android:layout_margin="10dp" 
     android:background="@color/gray_200" 
     android:orientation="vertical" /> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="5dp" 
     android:orientation="horizontal" > 

     <ImageButton 
      android:id="@+id/btnSwimming" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/swimming" /> 

     <ImageButton 
      android:id="@+id/btnHiking" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/hiking" /> 

     <ImageButton 
      android:id="@+id/btnYoga" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/yoga" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="1dp" 
     android:layout_margin="10dp" 
     android:background="@color/gray_200" 
     android:orientation="vertical" /> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="5dp" 
     android:background="@color/transparent" 
     android:orientation="horizontal" > 

     <ImageButton 
      android:id="@+id/btnWeightLift" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/weightlift" /> 

     <ImageButton 
      android:id="@+id/btnHockey" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/hockey" /> 

     <ImageButton 
      android:id="@+id/btnFrisbee" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/frisbee" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="1dp" 
     android:layout_margin="10dp" 
     android:background="@color/gray_200" 
     android:orientation="vertical" /> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="5dp" 
     android:orientation="horizontal" > 

     <ImageButton 
      android:id="@+id/btnKayak" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/kayak" /> 

     <ImageButton 
      android:id="@+id/btnGolf" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/golf" /> 

     <ImageButton 
      android:id="@+id/btnSkateboarding" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/skateboard" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="1dp" 
     android:layout_margin="10dp" 
     android:background="@color/gray_200" 
     android:orientation="vertical" /> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_margin="5dp" 
     android:orientation="horizontal" > 

     <ImageButton 
      android:id="@+id/btnBike" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/regular_biking" /> 

     <ImageButton 
      android:id="@+id/btnHunting" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/hunting" /> 

     <ImageButton 
      android:id="@+id/btnSnowboarding" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:background="@color/transparent" 
      android:src="@drawable/snowboarding" /> 
    </LinearLayout> 
</LinearLayout> 

XML FOR

public void changeFragment(String sportName) { 

    Bundle bundle = new Bundle(); 
    bundle.putString("SPORTNAME", sportName); 

    Fragment fragment = new SearchDetailsFragmentActivity(); 
    fragment.setArguments(bundle); 

    FragmentManager fm = getFragmentManager(); 
    FragmentTransaction transaction = fm.beginTransaction(); 

    transaction.setCustomAnimations(R.anim.cell_left_in, 
    R.anim.cell_right_out); 
    transaction.replace(R.id.contentFragment, fragment); 
    transaction.addToBackStack(null); 
    transaction.commit(); 
} 

XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="@drawable/white_noise_background" 
tools:context="${relativePackage}.${activityClass}" > 

<LinearLayout 
    android:id="@+id/linearLayout1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_margin="10dp" 
    android:background="@drawable/white_rounded_background" 
    android:gravity="center" 
    android:orientation="vertical" > 

    <TextView 
     android:id="@+id/tvSportsName" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="10dp" 
     android:text="Sports Name" 
     android:textColor="@color/gray_35" 
     android:textSize="20sp" /> 

    <TextView 
     android:id="@+id/tvZipcode" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="10dp" 
     android:text="Near 07735" 
     android:textColor="@color/gray_167" 
     android:textSize="15sp" /> 
</LinearLayout> 

<ListView 
    android:id="@+id/listView1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@+id/linearLayout1" 
    android:layout_centerHorizontal="true" > 
</ListView> 

01 최고 조각의 XML에 대한 23,516,
+0

이 '활동'에 대한 레이아웃 xml을 포함 할 수 있습니까? – Wakim

+0

두 프래그먼트 모두에 대해 XML을 포함했습니다. –

답변

2

내가

모든 시간에 한 번 같은 문제를 가지고에보기

아래

에 터치를 관통하지 않는 진정한 클릭주는

XML 레이아웃에 android:clickable="true" 제공 최고