繁体   English   中英

我该如何渲染屏幕

[英]How can i Render screen like this

这是我必须渲染的屏幕

当我尝试运行此代码时,列表项1与主要工具栏按钮重叠。我尝试了很多方法,但一次又一次遇到相同的问题。 我想将我的屏幕显示为上图。 在这里,我也提供我的代码。 请给我建议。

提前致谢。

<android.support.v4.widget.DrawerLayout        xmlns:android="http://schemas.android.com/apk/res/android"
         android:orientation="vertical"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
         android:background="#FFFFFF"
         android:id="@+id/sample_main_layout">  
            <ImageButton
                android:src="@drawable/ic_action_new"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                 android:adjustViewBounds="true"
                android:layout_weight="1"
                android:id="@+id/New"
                android:tag="-9999" />
            <ImageButton
                android:src="@drawable/ic_view_module"
                 android:adjustViewBounds="true"
                android:layout_weight="1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_toRightOf="@id/New"
                android:id="@+id/All"
                android:tag="-1" />               

              <FrameLayout
              android:id="@+id/sample_content_fragment"
              android:layout_weight="2"
              android:layout_width="match_parent"
              android:layout_height="0px">
              </FrameLayout>          
          <ListView
                    android:id="@+id/left_drawer"
                    android:layout_width="240dp"
                    android:layout_height="match_parent"
                    android:layout_gravity="left"
                    android:choiceMode="singleChoice"
                    android:divider="@android:color/transparent"
                    android:dividerHeight="0dp"
                    android:background="#dedede" />
</android.support.v4.widget.DrawerLay>

我不确定您是否尝试在主视图上渲染Button DrawerLayout将覆盖视图的整个高度。

抽屉已关闭:

在此处输入图片说明

抽屉打开:

在此处输入图片说明

<?xml version="1.0" encoding="utf-8"?>
<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">
    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
        <ImageButton
            android:src="@drawable/Icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
             android:adjustViewBounds="true"
            android:layout_weight="1"
            android:id="@+id/First"
            android:tag="-3" />
        <ImageButton
            android:src="@drawable/Icon"
             android:adjustViewBounds="true"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/First"
            android:id="@+id/Second"
            android:tag="-2" />   
        <ImageButton
            android:src="@drawable/Icon"
             android:adjustViewBounds="true"
            android:layout_weight="1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_toRightOf="@id/Second"
            android:id="@+id/Third"
            android:tag="-1" />
    </LinearLayout>
    <ListView android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="left"
        android:choiceMode="singleChoice"
        android:divider="@android:color/transparent"
        android:dividerHeight="0dp"
        />
</android.support.v4.widget.DrawerLayout>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM