i have created a simple custom appbar, I want to add text and icon, and also to change text color.
I tried it Like this, but didnt work.
Manifest - label
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".Login"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Signup"/>
<activity
android:name=".ForgotPassword"
android:label="#string/forgotpass" />
<activity
android:name=".CompanyProfile"
android:label="#string/your_company_profile" />
App_bar
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/colorAccent"
app:theme="#style/myCustomAppBarTheme"
app:popupTheme="#style/ThemeOverlay.AppCompat.Dark">
</android.support.v7.widget.Toolbar>
Main_menu
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
<item android:id="#+id/action_settings"
android:title="#string/action_settings"
android:showAsAction="always"
android:orderInCategory="100"
/>
</menu>
Style
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="AppTheme.Base">
<!-- Customize your theme here. -->
</style>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimaryDark</item>
<item name="colorPrimaryDark">#color/colorPrimary</item>
<item name="colorAccent">#color/colorAccent</item>
</style>
<!--************************* Custom Theme ******************************* -->
<style name="myCustomAppBarTheme" parent="Theme.AppCompat.Light">
<item name="android:actionBarStyle">#style/AppTheme.ActionBar</item>
<item name="actionBarStyle">#style/AppTheme.ActionBar</item>
</style>
<style name="AppTheme.ActionBar" parent="Widget.AppCompat.Light.ActionBar">
<item name="android:titleTextStyle">#style/AppTheme.ActionBar.TitleText</item>
<item name="titleTextStyle">#style/AppTheme.ActionBar.TitleText</item>
<item name="android:height">100dp</item>
<item name="height">100dp</item>
</style>
<style name="AppTheme.ActionBar.TitleText" parent="TextAppearance.AppCompat.Widget.ActionBar.Title">
<item name="android:textSize">20sp</item>
<item name="android:textColor">#color/colorWhite</item>
</style>
<!--**************************** Custom Theme ******************************* -->
</resources>
Activity
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:background="#color/colorWhite">
<!-- Include Appbar -->
<include
android:id="#+id/app_bar"
layout="#layout/app_bar" />
<!-- include Shadow below appbar -->
<View android:layout_width="match_parent"
android:layout_height="5dp"
android:background="#drawable/toolbar_dropshadow"/>
<RelativeLayout 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:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.example.baman.zupportdesk.ForgotPassword"
android:background="#color/colorWhite">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="#string/pass_forgot"
android:id="#+id/textView3"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textColor="#color/colorBlack"
android:textSize="14dp" />
<EditText
android:layout_width="match_parent"
android:layout_height="50dp"
android:inputType="textEmailAddress"
android:ems="10"
android:id="#+id/et_FP_email"
android:drawableLeft="#drawable/icon_person"
android:background="#color/editText_bg"
android:textSize="18sp"
android:hint="Enter email address"
android:paddingLeft="5dp"
android:textStyle="bold"
android:layout_below="#+id/textView3"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp" />
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="#string/submit"
android:id="#+id/btn_FP_submit"
android:textAllCaps="false"
android:background="#drawable/button_style"
android:textColor="#color/colorWhite"
android:textSize="20dp"
android:textStyle="bold"
android:layout_below="#+id/et_FP_email"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="20dp" />
</RelativeLayout>
</LinearLayout>
I want to add icon, Title and also change the tilte color in appbar. can some one help me to do this. tnx.
Edit your app_bar.xml as below:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="?android:attr/actionBarSize"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#color/colorAccent"
app:theme="#style/myCustomAppBarTheme"
app:popupTheme="#style/ThemeOverlay.AppCompat.Dark"><RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageButton
android:id="#+id/btn_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:background="#android:color/transparent"
android:src="#mipmap/ic_launcher" />
<TextView
android:id="#+id/txt_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="16dp"
android:layout_marginStart="16dp"
android:layout_toEndOf="#+id/btn_back"
android:layout_toRightOf="#+id/btn_back"
android:text="Title"
android:textColor="#android:color/white"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
Related
I am trying to figure out hw to remove padding from FUllscreen dialog
below is styles which we are using while creating dialog object :
<style name="full_screen_dialog" parent="#android:style/Theme.Dialog">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">match_parent</item>
<!-- No backgrounds, titles or window float -->
<item name="android:windowBackground">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">false</item>
<item name="android:padding">0dp</item>
<item name="android:layout_margin">0dp</item>
<item name="android:layout_gravity">bottom</item>
<!-- Just to prove it's working -->
<item name="android:background">#00000000</item>
</style>
below is the dialog content
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/main_content"
>
<RelativeLayout
android:id="#+id/layout2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#+id/layout1"
>
<com.theartofdev.edmodo.cropper.CropImageView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/cropImageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
app:cropAspectRatioX="5"
app:cropAspectRatioY="5"
app:cropShape="oval" />
</RelativeLayout>
<LinearLayout
android:id="#+id/layout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:weightSum="100">
<Button
android:id="#+id/cancel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="50"
android:background="#a9aeac"
android:clickable="true"
android:focusable="true"
android:text="Cancel"
android:textColor="#000000" />
<Button
android:id="#+id/submit"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="50"
android:background="#a9aeac"
android:clickable="true"
android:focusable="true"
android:text="Done"
android:textColor="#000000" />
</LinearLayout>
</RelativeLayout>
How to remove padding i have set the style but its not working
Following the codes:
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.your_dialog_content);
dialog.getWindow().setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
can you try set layouts without style class in xml file?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<EditText
android:id="#+id/add_school_schoolname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="#string/collegename"
android:inputType="textPersonName" />
<EditText
android:id="#+id/add_school_schoolweb"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="#string/collegeweb"
android:inputType="textPersonName" />
<Button
android:id="#+id/add_school_submit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="Submit" />
</LinearLayout>
</LinearLayout>
I got that error when i am using cliptochild & clipToPadding my parent view is clipping how can I resolve that problem how to resolve that issue when i am using recyclerview.
This is my style.xml
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:typeface">serif</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowAllowEnterTransitionOverlap">true</item>
<item name="android:windowAllowReturnTransitionOverlap">true</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:fitsSystemWindows">true</item>
<item name="android:clipChildren">false</item>
<item name="android:clipToPadding">false</item>
</style>
This is my layout.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/fare_bg"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:background="#drawable/fare_bg"
>
<LinearLayout
android:id="#+id/address_bar_lin"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
app:srcCompat="#drawable/ub__fare_split_search_icon" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:orientation="vertical"
android:padding="2dp">
<EditText
android:id="#+id/placesEdittxt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#android:color/transparent"
android:singleLine="true"
android:textColor="#color/textAddressColor"
android:textSize="12sp"
android:typeface="monospace" />
</LinearLayout>
<ImageView
android:id="#+id/img_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dp"
android:visibility="gone"
app:srcCompat="#drawable/ub__x_normal" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview"
android:layout_width="match_parent"
android:fitsSystemWindows="false"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:layout_weight="1"
android:background="#drawable/fare_bg" >
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
</LinearLayout>
Remove weight from recyclerview because the parent is Relative Layout and Try this:
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:paddingBottom="20dp"
android:fitsSystemWindows="false">
</android.support.v7.widget.RecyclerView>
I have used a custom style for the app and I am using 'TextInputLayout' Widget but when I am trying to change the font of edittext it's not being applied. Though When I am not using 'TextInputLatout' Widget, fonts are working fine.
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:textViewStyle">#style/RobotoTextViewStyle</item>
<item name="android:editTextStyle">#style/RobotoEditTextStyle</item>
</style>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
<style name="MyCustomToolBarTheme" parent="ThemeOverlay.AppCompat.Dark.ActionBar">
<item name="android:textColorPrimary">#000</item>
<item name="android:textColorSecondary">#FFF</item>
</style>
<style name="RobotoTextViewStyle" parent="android:Widget.TextView">
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="RobotoEditTextStyle" parent="android:Widget.EditText">
<item name="android:fontFamily">sans-serif-light</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="Base.ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="TextLabel" parent="TextAppearance.AppCompat">
<item name="android:fontFamily">sans-serif-light</item>
</style>
</resources>
Here is the code Inside Activity
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<include layout="#layout/app_bar"
android:id="#+id/app_bar"
android:layout_alignParentTop="true"
android:layout_height="wrap_content"
android:layout_width="match_parent" />
<LinearLayout
android:layout_below="#+id/app_bar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="16dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
>
<android.support.design.widget.TextInputLayout
android:id="#+id/error_et_login_email"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<EditText
style="#style/Widget.AppCompat.EditText"
android:id="#+id/et_login_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Email"
android:inputType="textEmailAddress"/>
</android.support.design.widget.TextInputLayout>
<android.support.design.widget.TextInputLayout
android:id="#+id/error_et_login_password"
android:layout_marginTop="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<com.github.itwenty.passwordedittext.PasswordEditText
android:id="#+id/et_login_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Password"
android:inputType="textPassword"
app:passwordPeek="true" />
</android.support.design.widget.TextInputLayout>
<RelativeLayout
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_login_create_account"
android:layout_alignParentLeft="true"
android:layout_marginRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Create Account?"
/>
<TextView
android:id="#+id/tv_login_forgot_password"
android:layout_alignParentRight="true"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Forgot Password?"
/>
</RelativeLayout>
<Button
android:id="#+id/btn_login_login"
android:layout_alignParentBottom="true"
android:elevation="20dp"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="LOGIN"
android:textColor="#FFF"
android:background="#000"
/>
</LinearLayout>
</LinearLayout>
Maybe you could do that programmatically, in your class, including your font in assets folder and with something like:
Typeface tf = Typeface.createFromAsset(getAssets(), "your_font.ttf");
TextInputLayout yourtextil= (TextInputLayout) findViewById(R.id.yourTextInputLayoutId);
yourtextil.getEditText().setTypeface(tf);
I have the following layout which basically displays two editTexts
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:layout_gravity="fill_vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
tools:context="global.sti.attendance.LogInActivity"
tools:showIn="#layout/activity_log_in">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:orientation="vertical"
android:paddingTop="150dp"
android:paddingBottom="50dp">
<EditText
style="#style/TextField"
android:id="#+id/userNameET"
android:hint="Enter username"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="#drawable/ic_user"
android:background="#drawable/custom_textfield"/>
<EditText
style="#style/TextField"
android:id="#+id/passwordET"
android:hint="Enter password"
android:layout_marginTop="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawableStart="#drawable/ic_lock"
android:background="#drawable/custom_textfield"/>
<Button
style="#style/Button"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Log-in"
android:id="#+id/loginButton"
android:layout_gravity="center_horizontal"
android:width="180dp" />
<Button
style="#style/Button"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SIGN-UP!"
android:id="#+id/signUpButton"
android:layout_gravity="center_horizontal"
android:width="180dp" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
This is my activity_log_in.xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="global.sti.attendance.LogInActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="#layout/content_log_in" />
</android.support.design.widget.CoordinatorLayout>
And this is my TextField style:
<style name="TextField">
<item name="android:textColor">#color/colorPrimary</item>
<item name="android:textCursorDrawable">#null</item>
<item name="android:paddingTop">10dp</item>
<item name="android:paddingBottom">10dp</item>
<item name="android:drawablePadding">10dp</item>
<item name="android:paddingLeft">10dp</item>
<item name="android:paddingRight">10dp</item>
<item name="android:height">40dp</item>
</style>
The problem is when I click on one of the editTexts and the keypad is showing, it blocks my views, I would expect the NestedScrollView will allow me to scroll up but it does not.
What seems to be the problem? Thanks!
Add this to your activity in the AndroidManifest.xml:
android:windowSoftInputMode="stateVisible|adjustResize"
Example:
<activity
android:name=".LogInActivity"
android:windowSoftInputMode="stateVisible|adjustResize">
<!-- Intent-filters if any -->
</activity>
all my layout are on top of my ActionBar. This seems like a very simple issue but I can't seem to figure it out.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="?android:attr/actionBarSize"
android:fitsSystemWindows="true" >
<TextView
android:id="#+id/txtLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16dp"
android:text="Home View"
android:layout_alignParentTop="true"
android:layout_alignParentStart="true" />
<ImageView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/txtLabel"
android:src="#drawable/ic_home"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:id="#+id/imageView" />
<Button
android:layout_width="fill_parent"
android:layout_height="40dp"
android:text="Logout"
android:id="#+id/logout"
android:textSize="13dp"
android:textColor="#000000"
android:layout_marginLeft="0dp"
android:layout_below="#+id/imageView"
android:layout_alignParentStart="true" />
</RelativeLayout>
Any ideas?
Thanks
Check the windowActionBarOverlay option in the theme you're using. Might be set to true. https://developer.android.com/training/basics/actionbar/overlaying.html
Problem Solved :D I change my ActionBar to Toolbar https://stackoverflow.com/a/26700904/4394523 :
this is now my themes.xml
<resources>
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimary_dark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:windowNoTitle">true</item>
<item name="windowActionBar">false</item>
</style>
</resources>
toolbar.xml
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="#android:style/TextAppearance.Theme"
android:textColor="#android:color/white" />
</android.support.v7.widget.Toolbar>
and put this in your layout:
android:layout_marginTop="?attr/actionBarSize"