1
처음에는 서랍 레이아웃으로 별표가있는 활동을하고 싶습니다. 난 그저 내 코드에 다양한 장소에서 활동 시작시 drawerLayout을 열려면 어떻게해야합니까?
mDrawerLayout.openDrawer(gravity.END());
을 넣어하지만 닫고 서랍을 다시 열 때까지 관계없이 항목 unclickable하게 노력했다.
아무도 이걸 가지고 행운이 있었나요? 주로이 기능을 추가하는 것이 사용자 경험을위한 것입니다.
내 서랍 레이아웃에는 목록보기가있어 클릭하면 활동 내에서 RecyclerView가 변경됩니다.
여기 내 XML 파일이 필요할 수 있습니다.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/colorPrimary"
android:orientation="vertical">
<!--android:elevation="4dp"-->
<!-- The drawer is given a fixed width in dp and extends the full height of
the container. -->
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The navigation drawer -->
<ListView
android:id="@+id/right_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:alpha="0.8"
android:background="@color/colorPrimary"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/my_toolbar2"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:alpha="1"
android:background="?attr/colorAccent"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
app:popupTheme="@style/ThemeOverlay.AppCompat" />
<android.support.design.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp"
android:layout_below="@+id/my_toolbar2">
<android.support.v7.widget.RecyclerView
android:id="@+id/listview2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:background="@color/colorPrimary"
android:dividerHeight="8dp" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:src="@drawable/ic_add_circle_outline_white_24dp"
android:visibility="visible"
app:elevation="24dp"
app:fabSize="auto"
app:layout_anchor="@+id/listview2"
app:layout_anchorGravity="bottom|end"
app:rippleColor="#FFF" />
</android.support.design.widget.CoordinatorLayout>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
이 중대하다 시작될 때. –