2012-05-03 2 views
0

나에게 많은 골칫거리를주고있는 안드로이드 버그를 발견했습니다. 매니페스트에onConfigurationChanged를 사용한 SlidingDrawer 회전

활동 :

<activity 
     android:name=".ActivityTest" 
     android:configChanges="orientation" 
     android:label="@string/app_name" /> 

레이아웃 :

<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="TEST" /> 

<SlidingDrawer 
    android:id="@+id/drawer" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:content="@+id/content" 
    android:handle="@+id/handle" 
    android:orientation="vertical" > 

    <ImageView 
     android:id="@id/handle" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ic_launcher" /> 

    <LinearLayout 
     android:id="@id/content" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" > 

     <Button 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:text="Big Big Button" /> 
    </LinearLayout> 
</SlidingDrawer> 
이제

가 .. 서랍의 손잡이를 잡고, 중간으로 이동하고 유지 장치를 돌리는 동안 손가락이 ...

서랍 치수는 모두 열렸습니다 ... 완전히 열리기 전까지.

Drawer in portrait closed Drawer half opened in portrait Drawer after rotation to landscape not resized (with finger still pressing)

누군가가 그것을 해결하는 방법의 ideia이있다? SlidingDrawer 시작 코드를 열어 볼 때 왜 괜찮아 지는지 확인하려고합니다. 그러나 아직 행운은 없습니다.

나는 서랍 슬라이딩 함께 일한 적이 내가 옵트 인 할 지금 기꺼이 옵션 ...

답변

0

좋아, 몇 가지 트릭과 그것을 해결하기 위해 관리 ... 터치 이벤트는 때때로 ... 절반 열린 서랍으로 회전 후 뷰에 도착하지 않는

먼저 난 후 서랍과 확장 : 추가 일부 코드에 대한 몇 가지 코드 :

@Override 
protected void onLayout(boolean changed, int l, int t, int r, int b) 
{ 
    if (mTracking && !rotationStopTracking) 
    { 
     return; 
    } 
    else if (rotationStopTracking) 
    { 
     rotationStopTracking = false; 
     if (isMoving()) 
     { 
      animateOpen(); 
      close(); 
     }else{ 
      animateOpen(); 
     } 
    } 

    ... 

    } 


//Called from Activity onConfigurationChanged 
public void enableRotationResize() 
{ 
    if (mTracking) 
    { 
     mTracking = false; 
     rotationStopTracking = true; 
    } 
} 
0

을 내 자신에 회전을하지 않는 처리, 그래서 난 그냥 던져거야하지 않음 아이디어는 여기에 있고 벽에 붙어있을 수도 있습니다.

onConfiguration이 호출 될 때마다 scren의 너비를 가져오고 슬라이딩 서랍의 layout_width를 해당 값으로 설정하면 어떨까요? 은 반 길이를 멈추고 화면을 회전시킬 때, 회전 후 폭이 회전 전의 폭과 같을 때처럼처럼 보입니다. 어쩌면 너비를 명시 적으로 설정하면 제대로 확장됩니다.

+0

거기에 있었으므로. – neteinstein