android - How to draw a top border on a bottom navbar -


i'm trying draw margin @ top of bottom navbar on android app. here it's have now:

this app now

what i'm trying achieve black top border on bottom bar. created using split action bar. xml:

<?xml version="1.0" encoding="utf-8"?> <resources>     <!-- theme applied application or activity -->     <style name="customactionbartheme"         parent="@android:style/theme.holo.light">         <item name="android:actionbarstyle">@style/myactionbar</item>         <item name="android:actionbarsplitstyle">@style/mybottombar</item>      </style>      <!-- actionbar styles -->     <style name="myactionbar"         parent="@android:style/widget.holo.light.actionbar.solid.inverse">         <item name="@android:background">@color/white</item>         <item name="@android:textcolor">@color/black</item>     </style>      <!--bottom bar style-->     <style name="mybottombar">         <item name="android:backgroundsplit">@color/white</item>     </style>      <!-- actionbar title text -->     <style name="myactionbartextstyle"         parent="@android:style/textappearance.holo.widget.actionbar.title">             <item name="@android:textcolor">@color/black</item>     </style>  </resources> 

i don't know need give bottom bar , android's documentation not clear. me please! thank all!

you need create new .xml file drawable folder. can call "bottom_navbar_background.xml". draw rectangle on file that:

<?xml version="1.0" encoding="utf-8"?>  <layer-list xmlns:android="http://schemas.android.com/apk/res/android">      <item android:bottom="1dp">         <shape             android:dither="true"             android:shape="rectangle">             <corners android:radius="2dp" />              <solid android:color="@color/black" />         </shape>     </item>      <item android:top="1dp">         <shape             android:dither="true"             android:shape="rectangle">               <solid android:color="@android:color/white" />              <padding                 android:bottom="0dp"                 android:left="0dp"                 android:right="0dp"                 android:top="0dp" />         </shape>     </item>  </layer-list> 

put background of custom theme of splitnavbar this:

<item name="android:backgroundsplit">@drawable/bottom_navbar_background</item> 

et voila: have top border on navbar!


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -