导航抽屉与android中的curverd边缘

Cha*_*ruක 12 layout android navigation-drawer material-design

我做了不同的导航抽屉类型,如永久,持久迷你变种,临时.

所有这些都是如下所示的轮廓形状的矩形.

在此输入图像描述


要求:我想创建一个带有弯曲边缘的导航抽屉(在右侧).

在此输入图像描述

我们来看看我的导航吧.视图

 <android.support.design.widget.NavigationView
            android:background="#FFF"
            android:id="@+id/nav_view"
            android:layout_width="wrap_content" android:layout_height="match_parent"
            android:layout_gravity="start" android:fitsSystemWindows="true"
            app:headerLayout="@layout/nav_header_main" app:menu="@menu/activity_main_drawer"/>
Run Code Online (Sandbox Code Playgroud)

它包含 app:headerLayout和a app:menu.如果我可以改变父NavigationView边缘的app:headerLayoutapp:menu将显示它里面的父边界.我对吗 ?

改变android:background对我来说不起作用.


有关添加什么dimendimens.xml有什么属性,我可以使用?

是否可以曲线导航抽屉的边缘(以编程方式或使用图像)?

如果是,任何指导都将受到高度赞赏.

rom*_*4ek 10

最后,我决定为这个案例创建库:https://github.com/rom4ek/ArcNavigationView,随时可以探索和使用它:)它基于Florent Champigny的ArcLayout,有一些调整,多亏了他.

建议使用这个lib的优点是它是基于NavigationView android设计库的标准构建的,你可以像往常一样使用它,只需更改类名即可.希望很快就能在jcenter上发表.以下是一些截图:

谢谢你的想法!:)


Mil*_*ank 6

这个Lib可以帮助你

https://github.com/mzule/FantasySlide

如何使用:XML

<com.github.mzule.fantasyslide.FantasyDrawerLayout   xmlns:app="http://schemas.android.com/apk/res-auto"
  android:id="@+id/drawerLayout"
  android:layout_width="match_parent"
  android:layout_height="match_parent">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:scaleType="centerCrop"
    android:src="@drawable/fake" />// this image is part of home scren 

<com.github.mzule.fantasyslide.SideBar
    android:id="@+id/leftSideBar"
    android:layout_width="200dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="@color/colorPrimary"
    app:maxTranslationX="66dp"> // This attribute is for curve  

    <!--  SideBar  -->

</com.github.mzule.fantasyslide.SideBar>
Run Code Online (Sandbox Code Playgroud)

JAVA:

SideBar leftSideBar = (SideBar) findViewById(R.id.leftSideBar);
leftSideBar.setFantasyListener(new SimpleFantasyListener() {
  @Override
  public boolean onHover(@Nullable View view) {
    return false;
  }

  @Override
  public boolean onSelect(View view) {
     return false;
   }

  @Override
   public void onCancel() {
  }
});
Run Code Online (Sandbox Code Playgroud)