Using Linearlayout Instead Of Recyclerview In Drawerlayout
Since I'm using a fixed menu for the navigation drawer I tried to use LinearLayout in DrawerLayout's second child instead of RecyclerView/ListView to make it easier to code. But th
Solution 1:
Any View
can act as a drawer in a DrawerLayout
. For the DrawerLayout
to recognize a View
as a drawer, it must have a layout_gravity
attribute set to left
/right
or start
/end
, depending on which vertical edge you want the drawer attached to.
The drawer's layout_height
is normally match_parent
, so that the drawer spans the full height of the DrawerLayout
, and its layout_width
is normally an exact measure - e.g., 240dp
- to keep a consistent width, independent of its contents.
Additionally, the drawer View
must be listed last within the DrawerLayout
to maintain the correct z-order, otherwise it will be covered by the content View
and won't receive click events.
Post a Comment for "Using Linearlayout Instead Of Recyclerview In Drawerlayout"