"Android Nano Degree" Project 0-Problem Summary

Source: Internet
Author: User

1. Page layout

Reference: http://www.xuebuyuan.com/1100763.html

Never know how to start a layout, use linear layout and properties margin,padding

2. Add a Click event

①trying to add Setonclicklistener on button but it's giving error "cannot resolve symbol ' Setonclicklistener '"

I've been through a circle of data to know that I've made a stupid question.

Put your button code in the OnCreate method. It'll work.

②after that, it's giving error "cannot resolve symbol ' Onclicklistener '"

Androidstudio shortcut key Alt+enter, View.onclicklistener (), this problem resolved.

Btn2.setonclicklistener (New View.onclicklistener () {}

3. Change the title bar color

Directly on the code:

Define the style of the title bar

<resources>
<style name= "TITLE_BG" parent= "Android: Theme" >
<item name= "Android:windowtitlebackgroundstyle" > @style/titleground</item>
</style>
<style name= "Titleground" >
<item name= "Android:background" > #ff8f26 </item>
</style>
</resources>

Setting styles in Manifest

Android:theme= "@style/TITLE_BG"

Using the last piece of code, it always goes wrong. Parent= "Android:theme", the program starts as crash.

After finding another method, modify the colorprimary and Colorprimarydark values; http://www.cnblogs.com/tianzhijiexian/p/4081562.html

But the actual effect is: only colorprimary effective, and the title bar is displayed colorprimary color. No solution after.



"Android Nano Degree" Project 0-Problem Summary

Related Article

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.