"Android" question about Actionbar can't display logo

Source: Internet
Author: User

I do not know if you have seen Google's official training courses, yesterday I was watching Actionbar this section of the time, there is a problem has been troubling me. The link to this guide I put on the following first. You can go and see more documents and definitely get more.

Http://developer.android.com/guide/topics/ui/actionbar.html


There was a passage, and I intercepted it and looked at it with the rest of us.


I this small rookie to offer an ugly, translation, translation of bad words, do not want to hit me ah.


Use logo to replace icon

By default, your app's icon is displayed on the action bar in the <application> or <activity> tab via the Android:icon property, but we can also use Android: Logo properties to specify a different icon to display.


A logo should usually be a little wider than the icon, but it should not contain unnecessary text. A reasonable usage scenario is that the logo should be well known to your users, and it represents your brand's logo. YouTube's mobile client is a good example--logo represents the user's intended logo, and the app icon is a modified version that is required to cater to the application's launch Icon square shape.


So curious I immediately created a new project on Android studio, try this feature, and then the sad things came. It is useless to change the logo, this is not a good idea. So I Google a bit, found a way to let it appear, But a little more trouble. You need to add a few words to the OnCreate () method. (It is emphasized that the activity parent class in the project is actionbaractivity, and if the parent is activity, there is no such problem.)


    ActionBar ActionBar = Getsupportactionbar ();    Actionbar.setdisplayshowhomeenabled (true);    Actionbar.setlogo (R.drawable.ic_action_refresh);    Actionbar.setdisplayuselogoenabled (TRUE);


This will show the logo, like this.


This is the only way I know to solve the problem at the moment. I also see a saying is that in the latest update, Google said, has recommended the compatibility package in the toolbar replace the original Actionbar, mother ah I still do not understand, and so I see the latest API back to update.

"Android" question about Actionbar can't display logo

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.