슬라이딩 드로어 위젯을 사용하여 Android 애플리케이션에서 뷰를 작성합니다. 내 자신의 사용자 지정 핸들을 구현했습니다 (메뉴 단추의 행이 서랍의 내용을 변경 한 다음 openAmination을 활성화합니다). slidingdrawer와 함께 제공되는 표준 핸들을 비활성화 할 수 있었지만 완전히 제거하고 싶습니다. XML 또는 자바의 표준 가시성 물건의슬라이딩 서랍 핸들 숨기기
없음 핸들을 제거/숨어 작동하지 않습니다 :
<SlidingDrawer android:layout_width="fill_parent"
android:id="@+id/slidingDrawer1"
android:layout_height="fill_parent"
android:handle="@+id/handle"
android:content="@+id/content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:allowSingleTap="false"
>
<Button android:layout_width="wrap_content"
android:text="Close"
android:layout_height="wrap_content"
android:id="@+id/handle"
android:visibility="gone" //DOES NOT WORK
</Button>
<LinearLayout android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF">
</LinearLayout>
</SlidingDrawer>
가 나는 또한 자바에서보기를 가져오고 같은 일을 시도했지만 역시 작동하지 않습니다.
View h = findViewById(R.id.handle);
h.setVisibility(View.GONE);
slideDrawer 클래스를 확장하고 직접 만들려고했으나 여전히 핸들이 필요합니다. 어쨌든 기본 핸들이없는 슬라이딩 서랍이 있습니까?
----- 솔루션 ----
draw = (SlidingDrawer)findViewById(R.id.slidingDrawer1);
//Close the draw if opened when the user touches elsewhere on the screen
draw.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
if(draw.isOpened())
((SlidingDrawer)v).animateOpen();
return false;
}});
//Open the draw by external button
((Button) findViewById(R.id.quiz_button)).setOnClickListener(
new Button.OnClickListener(){
@Override
public void onClick(View arg0) {
draw.animateOpen();
} });
슬라이딩 무승부 뷰의 XML했다 :
<SlidingDrawer android:layout_width="fill_parent" android:allowSingleTap="false" android:id="@+id/slidingDrawer1" android:content="@+id/content" android:handle="@+id/handle" android:layout_height="fill_parent" android:layout_alignParentTop="true" android:layout_alignParentLeft="true">
<Button android:layout_height="wrap_content" android:layout_width="0px" android:visibility="invisible" android:text="Close" android:id="@+id/handle"></Button>
<LinearLayout android:id="@+id/content" android:gravity="center" android:background="#4FFFFF44" android:layout_width="fill_parent" android:layout_height="76dp"></LinearLayout>
</SlidingDrawer>
많은 감사 샘
'Button'의'layout_widht'를'0px'로 설정해보십시오. –
은 충분히 잘 작동합니다! 이 경우 –
여기에서 SlidingDrawer의 슬라이딩 기능을 사용하려면 어떻게해야합니까? 나는 또한 똑같은 것을 시도하고있다. 버튼을 사용하지 않으면 내 슬라이딩 동작이 콘텐츠에 대해 작동하지 않습니다. 해결책이 있으면 알려주세요. – Raj