2012-11-21 8 views
0

내 레이아웃에서 갤러리를 사용하고 있습니다. OnItemSelected 함수에서보기 (갤러리 항목 아님)를 변경하려고하면 깨진 갤러리 애니메이션에 영향을줍니다 (멍청이가 나타나 부드럽게 보이지 않습니다). 나는 갤러리에서 다른보기를 선택한 후에 나타나는 표준 갤러리 애니메이션을 의미합니다.깨진 갤러리 애니메이션

<RelativeLayout 
    android:id="@+id/rl1" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:background="@drawable/p2_bg_nav"> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentRight="true" 
     android:layout_centerVertical="true" 
     android:layout_marginRight="10dp" 
     android:background="@drawable/p2_btn_nav_xml" 
     android:text="Настр." 
     android:textColor="#ffffff" /> 

    <TextView 
     android:id="@+id/textView1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_centerHorizontal="true" 
     android:layout_centerVertical="true" 
     android:text="Мои карты" 
     android:textStyle="bold" 
     android:textColor="#ffffff" 
     android:textAppearance="?android:attr/textAppearanceLarge" /> 

</RelativeLayout> 

<Gallery 
    android:id="@+id/gallery" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:spacing="20dp" 
    android:padding="20dp" 
    android:unselectedAlpha="1.0" 
    android:background="#fa0000" /> 

<ListView 
    android:id="@+id/listView" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_below="@id/rl1" 
    android:layout_above="@id/gallery" 
    android:background="#d8d8d8" > 

</ListView> 

아마 애니메이션 중지 이벤트에 대한 리스너를 설정하는 방법이 여기있다 :

mGallery.setOnItemSelectedListener(new OnItemSelectedListener() { 

    @Override 
    public void onItemSelected(AdapterView<?> arg0, View arg1, int pos, long arg3) { 
     mTextView1.setText("asda"); 
    } 

    @Override 
    public void onNothingSelected(AdapterView<?> arg0) { 

    } 

}); 

레이아웃입니까?

또 다른 것은 내 갤러리 항목에 TextView가 있다는 것입니다. TextColor는 검은 색으로 설정되어 있지만 갤러리의 선택된 항목에 대해서만 검은 색입니다. 선택하지 않은 항목의 텍스트 색상 변경을 피할 수있는 방법은 무엇입니까?

감사합니다.

답변

0

이유는 모든보기와 갤러리가 상대적 레이아웃으로 연결되어 있다는 것입니다. 하나의보기를 변경하면 모든 레이아웃이 다시 그리기되고 갤러리 자체도 변경됩니다.