Create a menu problem in the Android Studio environment (title bar display problem)

Source: Internet
Author: User

When you create a menu, the menu (three points, 1) is displayed on the virtual device, but it may not appear on the An Zuojin machine.

(Fig. 1)

The reason is because the Android system now hides the title bar by default, so the menu is not displayed.

There are two ways to solve this problem:

Method One: Add the display title bar code after the OnCreate () function: Setcontentview (R.layout.xxx_layout);

If the problem is still not resolved, review your own activity class for inheritance issues, if the discovery class begins with this: public class XXX extends activity () {...}. The activity is inherited, and the appcompatactivity is inherited instead.

 Public class extends  appcompatactivity{@override ...    }

Method Two: Add in the Strings.xml file of the Res.value file

1 <item name= "Android:windowactionbar" >true</item>23 <item Name = "Android:windownotitle" >false</item>

Create a menu problem in the Android Studio environment (title bar display problem)

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.