Separators For Navigation

Separators for Navigation

Simply use the separator image as a background image on the li.

To get it to only appear in between list items, position the image to the left of the li, but not on the first one.

For example:

#nav li + li {
background:url('seperator.gif') no-repeat top left;
padding-left: 10px
}

This CSS adds the image to every list item that follows another list item - in other words all of them but the first.

NB. Be aware the adjacent selector (li + li) doesn't work in IE6, so you will have to just add the background image to the conventional li (with a conditional stylesheet) and perhaps apply a negative margin to one of the edges.

What is the proper way to put divider lines between navigation links?

Pipe characters work, but you could do the same thing with some CSS.

If your markup is like this:

<nav>
<a href="/about.html">About</a>
<a href="/portfolio.html">Portfolio</a>
<a href="/contact.html">Contact</a>
</nav>

You can add some CSS to style the "right side" of each link element to have a border, except for the last element because you don't want a floating divider line on the end of the links.

nav > a {
border-right: solid 1px #eff0f1;
}
nav > a:last-of-type {
border-right: none;
}

This will add a border to the right side of all your nav links, but then overrides the final nav link to not have a right border.

How to add one section separator for Navigation Drawer in Android?

Make sure you define each group with a unique ID, separator won't appear without the ID.

For example, this is my drawer_menu.xml:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<group
android:id="@+id/menu_top"
android:checkableBehavior="single">
<item
android:checked="true"
android:id="@+id/drawer_item_timeline"
android:icon="@drawable/ic_timer_grey600_24dp"
android:title="@string/drawer_timeline"/>
<item
android:id="@+id/drawer_item_reports"
android:icon="@drawable/ic_timetable_grey600_24dp"
android:title="@string/drawer_reports"/>
</group>

<group
android:id="@+id/menu_bottom"
android:checkableBehavior="none">

<item
android:id="@+id/drawer_item_settings"
android:icon="@drawable/ic_settings_black_24dp"
android:title="@string/drawer_settings" >
</item>
</group>
</menu>

Sample drawer

Gabriel adds below in the comments that if the group doesn't have an id, the separator will not appear.

CSS separator for navigation in Wordpress

Try to add this to your css style:

.nav-header li + li:before{
content: ".";
position: relative;
float: left;
top: 11px;

}

Separator between content and bottom navigation view (material) like PlayStore

I think I found out how the play store is doing it.
There exists a material component called "Divider".

I just added it as a child view of the BottomNavigationView and it looks exactely the same as on the play store.

Here's the new code of the child view:

<View
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider" />

Add one section separator for Navigation Drawer in Android

Try this....

    <group>
<item android:title="Express">
</item>
</group>



<group
android:id="@+id/grpid1"
android:checkableBehavior="single">
<item
android:id="@+id/nav_balance_transfer"
android:icon="@mipmap/ic_launcher"
android:title="Balance Transfer" />

<item
android:id="@+id/nav_load_money"
android:icon="@mipmap/ic_launcher"
android:title="Load Money" />
<item
android:id="@+id/nav_report"
android:icon="@mipmap/ic_launcher"
android:title="Report" />
</group>



<group>
<item android:title="My Information">



</item>
</group>


<group
android:id="@+id/grpid2"
android:checkableBehavior="none">
<item
android:id="@+id/nav_profile"
android:icon="@mipmap/ic_launcher"
android:title="My Account" />
<item
android:id="@+id/nav_changePassword"
android:icon="@mipmap/ic_launcher"
android:title="Change Password" />
<item
android:id="@+id/nav_ViewUser"
android:icon="@mipmap/ic_launcher"
android:title="View User" />
<item
android:id="@+id/nav_addUser"
android:icon="@mipmap/ic_launcher"
android:title="Add User" />
<item
android:id="@+id/nav_addScheme"
android:icon="@mipmap/ic_launcher"
android:title="Add Scheme" />

<item
android:id="@+id/nav_logout"
android:icon="@mipmap/ic_launcher"
android:title="Log Out" />

</group>


</menu>

It looks like you just need to give your group tags unique ID's.

<group android:id="@+id/ids">
<!-- Divider will appear above this item -->
<item ... />
</group>

Sample Image

Sure @Tufan I can solve this problem also

Do this... put these lines to your dimen.xml

<dimen name="design_navigation_padding_top_default" tools:override="true">0dp</dimen>
<dimen name="design_navigation_separator_vertical_padding" tools:override="true">0dp</dimen>
<dimen name="design_navigation_padding_bottom" tools:override="true">0dp</dimen>

dimen.xml

<resources
xmlns:tools="http://schemas.android.com/tools"
>

<dimen name="design_navigation_padding_top_default" tools:override="true">0dp</dimen>
<dimen name="design_navigation_separator_vertical_padding" tools:override="true">0dp</dimen>
<dimen name="design_navigation_padding_bottom" tools:override="true">0dp</dimen>
<dimen name="navigation_separator_vertical_padding">0dp</dimen>

</resources>

New Screenshot remove padding by add this..

Sample Image



Related Topics



Leave a reply



Submit