我搜索了很多,但很容易管理导航,但此时需要实现持久导航抽屉。
https://www.google.com/design/spec/patterns/navigation-drawer.html#navigation-drawer-behavior
Please let me know the process to Manage or Sample Tutorial of **Persistent Navigation Drawer** shown in below Image. LinkedIn Android Application is using the same navigation drawer.
由于
答案 0 :(得分:1)
我已实施"持久导航抽屉"通过ViewPager,我可以正常工作。
在PagerAdaper / FragmentPagerAdapter
中使用宽度为0.8fSELECT p.name AS p_name, p.id AS pid, p.description AS p_description,
GROUP_CONCAT(r.id SEPARATOR ',') AS rids,
GROUP_CONCAT(r.name SEPARATOR ',') AS rnames
FROM `profiles` p
LEFT JOIN rights r ON p.id = r.profile_id
WHERE p.app_id = 8
GROUP BY p_name
答案 1 :(得分:1)
我的XML文件:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:facebook="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<!-- Framelayout to display Fragments -->
<RelativeLayout
android:id="@+id/mainView"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<!-- Listview to display slider menu -->
<RelativeLayout
android:id="@+id/drawerView"
android:layout_width="240dp"
android:layout_height="wrap_content"
android:layout_gravity="start" >
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/list_background"
android:divider="@color/list_divider"
android:dividerHeight="1dp" />
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
我的活动:
public class ProfileActivity extends ActionBarActivity {
....
private DrawerLayout mDrawerLayout;
private ActionBarDrawerToggle mDrawerToggle;
RelativeLayout drawerView;
RelativeLayout mainView;
....
@Override
protected void onCreate(Bundle savedInstanceState) {
............. //
.............//
drawerView = (RelativeLayout) findViewById(R.id.drawerView);
mainView = (RelativeLayout) findViewById(R.id.mainView);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, R.drawable.ic_drawer, R.string.app_name, R.string.app_name) {
public void onDrawerClosed(View view) {
supportInvalidateOptionsMenu();
}
public void onDrawerOpened(View drawerView) {
supportInvalidateOptionsMenu();
}
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
super.onDrawerSlide(drawerView, slideOffset);
mainView.setTranslationX(slideOffset * drawerView.getWidth());
mDrawerLayout.bringChildToFront(drawerView);
mDrawerLayout.requestLayout();
}
};
mDrawerLayout.setDrawerListener(mDrawerToggle);}
}
onDrawerSlide中的代码可以为您提供所需的内容。