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