草庐IT

Android Navigation Drawer垂直边框

coder 2023-12-11 原文

我想让我的 NavigationDrawer 就像在这个应用程序中一样

更具体地说,我想在右侧添加 1 像素的小边框

但这是我从抽屉里得到的东西

这是抽屉 fragment 的 xml

<ListView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#E7E7E7"
android:choiceMode="singleChoice"
android:dividerHeight="0.5dp" />

我需要做什么?

最佳答案

试试这个,

DrawerLayout mDrawerLayout;

onCreate(Bundle ...){
    //...
    mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow,
                    GravityCompat.START);
    //...
}

编辑

你需要添加一个 ViewListView 并用一个 LinearLayout 水平包裹它们并给它们一些 weight.这里我给 listView 赋予了 0.99 的权重,给 view 赋予了 0.01 的权重,你可以根据自己的需要进行更改.

<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" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <ListView android:id="@+id/drawer_list"
            android:layout_weight="0.99"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#E7E7E7"
            android:choiceMode="singleChoice"
            android:dividerHeight="0.5dp" />

        <View
            android:layout_weight="0.01"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:background="#eeccbb"/>
    </LinearLayout>

</android.support.v4.widget.DrawerLayout>

关于Android Navigation Drawer垂直边框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28864834/

有关Android Navigation Drawer垂直边框的更多相关文章

  1. ruby - 在 Ruby 中,垂直线是什么? - 2

    1.upto(9){|x|printx}为什么这行不通?{printx|x}}y呢? 最佳答案 它用于传递给您的block的参数。即在您的示例中,upto将使用1到9中的每个数字调用您的block,当前值可作为x获得。block参数可以有任何名称,就像方法参数一样。例如1.upto(9){|num|putsnum是有效的。就像一个方法的参数一样,一个block也可以有多个参数。例如hash.each_pair{|key,value|puts"#{key}is#{value}"} 关于ru

  2. ruby - Prawn :有没有办法让一个盒子里的所有内容垂直对齐? - 2

    我正在尝试将一些内容垂直居中放置在bounding_box中。对于单个文本,这没问题:bounding_box([0,bounds.top],:width=>pdf.bounds.right,:height=>pdf.bounds.top)dotext"verticallyalignedinthesurroundingbox",:valign=>:centerend但是如果我的边界框中有多个元素,我该怎么办:bounding_box([0,bounds.top],:width=>pdf.bounds.right,:height=>pdf.bounds.top)dotext"vertic

  3. javascript - 在聚焦和模糊时更改 TinyMCE 的边框颜色 - 2

    我将jQuery与TinyMCE结合使用。我试图让边框颜色在TinyMCE编辑器处于焦点时改变,然后在模糊时改变回来。在ui.css中,我添加/更改了这些:.defaultSkintable.mceLayout{border:0;border-left:1pxsolid#93a6e1;border-right:1pxsolid#93a6e1;}.defaultSkintable.mceLayouttr.mceFirsttd{border-top:1pxsolid#93a6e1;}.defaultSkintable.mceLayouttr.mceLasttd{border-bottom:

  4. javascript - 动画底部边框(从左到右) - 2

    我试图让底部边框从左到右。我似乎也无法将它直接定位在标题下方,并且它从中心向外动画。我不确定要更改什么。https://jsfiddle.net/81uo76hx/2/.slider{position:absolute;display:block;left:50%;top:90%;transform:translate(-50%,0);position:absolute;top:43%;margin:0auto;height:2px;background-color:#000;width:0%;} 最佳答案 希望你能用javascr

  5. javascript - Excel 导出为 html 无法在 Excel 2016 中显示边框 - 2

    我正在使用JavaScript将html导出到Excelxls文件,如下面的演示所示:http://js.do/sun21170/84913.我使用GoogleChrome来运行这个演示,但它也应该在Edge或IE或FireFox中运行。问题是,当我在Excel2016中打开导出的文件时,它显示没有任何边框,即使导出的html中有CSS来显示边框。问题:有没有办法在Excel中打开html文件时显示边框?在Excel中打开的相同html,在浏览器中呈现带有边框,因此边框的CSS是正确的。演示在http://js.do/sun21170/84913还显示了保存在Excel文件中的html

  6. javascript - 将数据添加到垂直滚动文档时,如何保持前面的部分可见? - 2

    这是无限滚动的一部分,当我们向上滚动时也有效:InitialContent111InitialContent222InitialContent333InitialContent444InitialContent555InitialContent666InitialContent777JS代码:vardataAbc='FocusShiftedHere';setTimeout(function(){$(dataAbc).prependTo("#sContainer");},3000);setTimeout(function(){$(dataAbc).prependTo("#sContain

  7. javascript - 滚动垂直视差 - 2

    我正在研究简化的垂直视差(类似于http://nikebetterworld.com)。我有一个quickdemoworking-代码在技术上是可行的,但每次滚动后我都会对重绘产生紧张的效果-似乎javascript发生得很晚。知道为什么吗?我在脚本中看不到任何真正突出的地方。vargetYPosition=function(){if(typeof(window.pageYOffset)=='number'){returnwindow.pageYOffset;}else{returndocument.documentElement.scrollTop;}};$(document).re

  8. javascript - jqplot 垂直轴标签 - 2

    一个非常简单的问题,但我无法弄清楚...我尝试使用jqplot生成带有垂直y轴标签的线图。基于jqplotwebsite中的示例,我只需要使用这个插件jqplot.canvasAxisLabelRenderer.min.js。我在本地尝试过,但没有用。任何人都可以给我一个提示吗?这是一个demo我的问题。下面是我的代码:$(document).ready(function(){$.jqplot.config.enablePlugins=true;vars1=$.parseJSON($('#x_indi_val').text());$.jqplot('chart1',[s1],{seri

  9. javascript - Highcharts 中选定列的不同边框 - 2

    我在我的应用程序中使用了highchart的柱形图。我有柱形图。当用户选择图表中的一列时,所选列应以不同的边框颜色和不同的宽度显示。这是代码片段$(function(){varchart=newHighcharts.Chart({chart:{renderTo:'container',type:'column'},xAxis:{categories:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']},plotOptions:{series:{allowPointSelect:true,ma

  10. javascript - 在 VUE 中切换样式时边框样式无法正确呈现 - 2

    检查这个demo下面:newVue({ el:'#app',data:{ flag:true},computed:{ style(){letstyleA={borderBottom:'1pxsolidred',borderRight:'1pxsolidred'};letstyleB={ border:'1pxsolidgreen',borderRight:'1pxsolidred'}returnthis.flag?styleA:styleB}},methods:{ changeStyle(){ this.flag=!this.flag;}}}).box{width:100px;heig

随机推荐