Android Toolbar Effect 2

Source: Internet
Author: User

Case with only one button

<resources>
<string name= "App_name" > Photos </string>
</resources>
Styles.xml
<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>


<!--Toolbar Styles--
<item name= "Toolbarstyle" > @style/widget.appcompat.toolbar</item>
</style>

</resources>

Mainactivity.java

Toolbar Mytoolbar = (Toolbar) Findviewbyid (R.id.my_toolbar);
Setsupportactionbar (Mytoolbar);
Getsupportactionbar (). Setdisplayhomeasupenabled (True);

Activity_main.xml

<?XML version= "1.0" encoding= "Utf-8"?><Android.support.constraint.ConstraintLayoutxmlns: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"Tools:context= "Com.homelink.testtoolbar7.MainActivity">    <Android.support.v7.widget.Toolbarstyle= "Style/toolbarstyle"Android:id= "@+id/my_toolbar"xmlns:android= "Http://schemas.android.com/apk/res/android"Android:layout_width= "Match_parent"Android:layout_height= "Wrap_content"Android:background= "? Attr/colorprimary"Android:minheight= "? Attr/actionbarsize">        <ImageViewAndroid:id= "@+id/bluetoothstate"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:src= "@drawable/fm_detailitem_walk"android:contentdescription= "Content_description_bluetooth_status"android:padding= "8DP"Android:layout_marginright= "10DP"android:layout_gravity= "Right"/>    </Android.support.v7.widget.Toolbar>    <TextViewAndroid:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"Android:text= "Hello world!"App:layout_constraintbottom_tobottomof= "Parent"App:layout_constraintleft_toleftof= "Parent"App:layout_constraintright_torightof= "Parent"App:layout_constrainttop_totopof= "Parent" /></Android.support.constraint.ConstraintLayout>
View Code

Android Toolbar Effect 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.