왼쪽에서 안드로이드 슬라이딩 드드로이어를 슬라이드하는 방법은 무엇입니까?
-
16-09-2019 - |
문제
나는 a를 사용하고있다 slidingDrawer
내 응용 프로그램에서는 초상화 모드에있을 때 핸들러가 바닥에 배치되어 있습니다. 사용자가 조경 모드 (와이드 스크린)로 전환하면 핸들러가 왼쪽에 위치하고 싶습니다. 방향을 수직에서 수평으로 변경하면 핸들러가 오른쪽에 배치됩니다.
내 레이아웃 XML을 다음과 같이 정의했습니다.
<SlidingDrawer
android:id="@+id/l_drawer"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:handle="@+id/l_handle"
android:content="@+id/l_content"
android:orientation="horizontal"
android:layout_gravity="left"
>
누구든지 왼쪽에서 오른쪽으로 슬라이드하는 방법에 대한 아이디어가 있습니까?
해결책
나는 당신이 할 수 있다고 생각하지 않습니다. SlidingDrawer
소스 코드, 변경 및 수정 된 버전 사용. 당신도 마찬가지로 a를 만들 수 없습니다 SlidingDrawer
그것은 정상에서 내려갑니다.
다른 팁
그렇게하는 간단한 방법을 찾았습니다. 슬라이딩 드다러, 내용 및 핸들의 경우 180º의 회전을 설정하는 것입니다. 내가했던 것처럼 비슷하게 상단에서 내려 오는 슬라이딩 드다이어를 만들 수 있습니다. 여기.
차이점을 볼 수 있도록 오른쪽에서 왼쪽으로 먼저 내 예제를보십시오.
<SlidingDrawer xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/slidingDrawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_horizontal"
android:handle="@+id/handle"
android:content="@+id/content">
<ImageView android:id="@+id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
<ImageView android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FF0000"
android:src="@drawable/ic_launcher" />
</SlidingDrawer>
이제 왼쪽에서 미끄러지도록 변경 한 내용을보십시오.
<SlidingDrawer xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/slidingDrawer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_horizontal"
android:handle="@+id/handle"
android:content="@+id/content"
android:rotation="180">
<LinearLayout android:id="@+id/handle"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
android:rotation="180" />
</LinearLayout>
<ImageView android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FF0000"
android:src="@drawable/ic_launcher"
android:rotation="180" />
</SlidingDrawer>
또한 핸들로 설정하기 위해 선형 레이 아웃을 만들었고 회전을 변경하지 않았지만 아이의 회전을 변경했습니다. 이것은 내가 가진 작은 문제를 막기위한 것이었지만 모든 것이 잘 작동하고 간단합니다.
수업을 다시 작성하여 오픈 소스 라이브러리의 일부로 만들었습니다. 제대로 얻는 데 거의 일주일이 걸렸습니다. 내 확인 해주세요 슬라이딩 트레이 안에 aniqroid 안드로이드를위한 오픈 소스 라이브러리.
http://aniqroid.sileria.com/doc/api
위의 링크에서 다운로드 링크와 SlidingTray 클래스의 문서를 찾으십시오.
(공개 : 나는 프로젝트의 관리자입니다.)
이 답변에 게시 된 코드를 사용할 수 있습니다. 상단에서 안드로이드 슬라이딩 드래커?
제공된 솔루션은 XML에서 슬라이딩 드다이어의 방향을 설정하는 기능을 특징으로합니다. 또한 SDK의 Androids 슬라이딩 드 데어링에서 파생되기 때문에 atts.xml 및 안정적인 추가로 1 클래스와 일부 추가가 필요한 간단합니다. 또한 인터넷에서 발견 된 다른 인기있는 Libs/솔루션을 선택하지 않은 이유에 대해서도 논의합니다.
요점에 대한 QuickLink : MultipleorientationSLidingDrawer (소스 및 예) @ gist