我正在我的应用中实施Navigation drawer
。一切都好。它的工作。但是在平板电脑上有一些设计问题。项目行高度因手机和平板电脑而异。
我正在为手机和平板电脑分享屏幕截图
平板电脑的第一张图片和手机的第二张图片。如何在平板电脑布局上给出与手机布局相同的间距。
布局Xml:
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:openDrawer="start">
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:visibility="gone"
app:theme="@style/NavigationViewStyle"
app:headerLayout="@layout/nav_header"
app:menu="@menu/nav_items" />
</android.support.v4.widget.DrawerLayout>
nav_items:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group android:checkableBehavior="single">
<item
android:id="@+id/nav_home"
android:title="@string/home"
android:icon="@drawable/ic_home_black_24dp"
android:divider="@color/colorPrimary"
android:dividerHeight="4dp"/>
<item
android:id="@+id/nav_Sign_in"
android:title="@string/Sign_in"
android:icon="@drawable/ic_lock_outline_black_24dp"
android:divider="@color/colorPrimary"
android:dividerHeight="20dp" />
<item
android:id="@+id/nav_Sign_up"
android:title="@string/Sign_Up"
android:icon="@drawable/ic_lock_open_black_24dp"
android:divider="@color/colorPrimary"/>
<item
android:id="@+id/nav_Support"
android:title="@string/Support"
android:icon="@drawable/ic_build_black_24dp"
android:divider="@color/colorPrimary"/>
<item
android:id="@+id/nav_Express_check_in"
android:title="@string/Express_Check_in"
android:icon="@drawable/ic_done_all_black_24dp"
android:divider="@color/colorPrimary"/>
<item
android:id="@+id/nav_Write_review"
android:title="@string/Write_review"
android:icon="@drawable/ic_write"
android:divider="@color/colorPrimary"/>
<item
android:id="@+id/nav_HD_cash"
android:title="@string/HD_cash"
android:icon="@drawable/ic_gift"
android:divider="@color/colorPrimary"/>
<item
android:id="@+id/nav_Refers_to_friends"
android:icon="@drawable/ic_group_add_black_24dp"
android:title="@string/Refers_to_friends" />
<item
android:id="@+id/nav_Rate_US"
android:icon="@drawable/ic_thumb_up_black_24dp"
android:title="Rate our App" />
<item
android:id="@+id/nav_sign_out"
android:icon="@drawable/ic_phonelink_lock_black_24dp"
android:title="Sign Out"
></item>
</group>
</menu>
NavigationViewStyle:
<style name="NavigationViewStyle" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorControlNormal">@color/toolbarText</item>
<item name="android:textSize">20sp</item>
<item name="android:textColor">@color/colorAccent</item>
</style>