Android realizes QQ New user registers the interface to encounter the problem and solves the method _android

Source: Internet
Author: User

In the previous article to introduce the Android QQ login interface encountered problems and solutions, this article continues to introduce you to the Android QQ interface knowledge.

First to show you the effect of the picture:

Problem:

1. Drop down list (because you haven't seen this yet ...) )

2, the title bar display problems

3, the button to Enable settings

Here's the code:

Layout Fragment_main (Issue 1)

<relativelayout xmlns:android= "http://schemas.android.com/apk/res/android" xmlns:tools= "http:// Schemas.android.com/tools "android:layout_width=" match_parent "android:layout_height=" Match_parent "Android: Focusable= "true" android:focusableintouchmode= "true" android:background= "#F7F7F9" tools:context= " Com.dragon.android.qqregist.mainactivity$placeholderfragment "> <button android:id=" @+id/button2 "Android: Layout_width= "Wrap_content" android:layout_height= "50DP" android:layout_alignparenttop= "true" android:background= "#ffffff" android:drawableleft= "@drawable/aa" android:text= "@string/button2" android:textcolor= "#1CBAF5"/> < TextView android:id= "@+id/textview2" android:layout_width= "match_parent" android:layout_height= "50DP" Android:layo Ut_alignbaseline= "@+id/button2" android:layout_alignbottom= "@+id/button2" android:background= "#ffffff" Android: gravity= "center" android:text= "@string/pagename" android:textcolor= "#1CBAF5"/> <LinearLayout android:id= "@+id/linear" android:layout_width= "match_parent" android:layout_height= "Wrap_content" and roid:orientation= "Horizontal" android:layout_below= "@id/button2" android:paddingtop= "30DP" android:paddingBottom=
  "20DP" > <spinner android:id= "@+id/spinner1" android:layout_width= "0DP" android:layout_height= "Wrap_content" android:background= "@drawable/bg_spinner" android:layout_weight= "1" android:entries= "@array/country"/> <Edi Ttext android:id= "@+id/edittext1" android:layout_width= "0DP" android:layout_height= "Wrap_content" Android:layout_ weight= "2" android:background= "@drawable/bg_edittext" android:ems= "android:inputtype=" Phone "android:hint=" @s Tring/innum "android:color=" #000000 "android:textsize=" 15SP "> </EditText> </LinearLayout> <butto n android:id= "@+id/button1" android:layout_width= "match_parent" android:layout_height= "Wrap_content" android:layou t_marginleft= "10DP" Android:layout_marginright= "10DP" android:layout_below= "@id/linear" android:enabled= "false" android:background= "@ Drawable/bg_button "android:text=" @string/button "android:gravity= Center" android:textcolor= "#FFFFFF"/> <Ch Eckbox android:id= "@+id/checkbox1" android:layout_width= "wrap_content" android:layout_height= "Wrap_content" Androi d:layout_margintop= "10DP" android:layout_marginleft= "10DP" android:layout_below= "@id/button1" android:text= "@ String/sure "android:textsize=" 12SP "android:textcolor=" #A6A6A7 "/> <textview android:id=" @+id/textview1 "a Ndroid:layout_width= "Wrap_content" android:layout_height= "wrap_content" android:layout_alignbaseline= "@+id/" CheckBox1 "android:layout_alignbottom=" @+id/checkbox1 "android:layout_marginleft=" 10DP "android:layout_torightof= "@+id/checkbox1" android:autolink= "All" android:text= "@string/protocol" android:textsize= "12sp"/> </Relative Layout> Fragment_main

Background before and after EditText, Spinner and Button modifications

<?xml version= "1.0" encoding= "Utf-8"?> <shape xmlns:android=
"http://schemas.android.com/apk/res/" Android ">
 <stroke android:width=" 1px "android:color=" #BEBEBE "/>
 <solid android:color=" #FFFFFF "/>
 <padding 
  android:left=" 10DP "
  android:top=" 10DP "
  android:bottom=" 10DP "/>
</ Shape>
Bg_edittext
<?xml version= "1.0" encoding= "Utf-8"?> <shape xmlns:android=
"http://schemas.android.com/apk/res/" Android ">
 <stroke android:width=" 1px "android:color=" #BEBEBE "/>
 <solid android:color=" # FFFFFF "/>
 <padding 
  android:left=" 10DP "
  android:top=" 10DP "
  android:bottom=" 10DP "/>
</shape>
Bg_spinner
<?xml version= "1.0" encoding= "Utf-8"?> <shape xmlns:android=
"http://schemas.android.com/apk/res/" Android ">
 <solid android:color=" #808080 "/>
 <corners android:radius=" 10DP "/>
 < padding 
  android:top= "10DP" 
  android:bottom= "10DP"/>
</shape>
Bg_button
<?xml version= "1.0" encoding= "Utf-8"?> <shape xmlns:android=
"http://schemas.android.com/apk/res/" Android ">
 <solid android:color=" #1CBAF5 "/>
 <corners android:radius=" 10DP "/>
 < padding 
  android:top= "10DP" 
  android:bottom= "10DP"/>
</shape>
bg_buttin_change

Spinner Drop-down Data arrays

<?xml version= "1.0" encoding= "Utf-8"?>
<resources>
 <string-array name= "Country" >
  <item > China  +86</item>
  <item > Hongkong  +852</item>
  <item > Macau  +853</ Item>
  <item > Taiwan  +886</item>
  <item > Japan  +81</item>
  <item > USA  +1</item>
  <item > UK  +44</item>
 </string-array>
</ resources>
Arrays

Background of title bar (Issue 2--discard)

 <?xml version= "1.0" encoding= "Utf-8"?> <resources "xmlns:android=" Schemas.android.com/apk/res/android "> <style name=" bg_title "parent=" Android:theme "> <item name=" Android:windowtitlebackgroundstyle "> @style/titleground</item> <item name=" Android:windowtitlestyle " > @style/windowtitlestyle</item> <item name= "android:windowtitlesize" >40dp</item> </style > <style name= "titleground" > <item name= "android:background" > #FFFFFF </item> </style> ; style name= "Windowtitlestyle" > <item name= "android:text" > @string/pagename</item> <item name= " Android:textcolor "> #1CBAF5 </item> <item name=" android:paddingtop ">2dp</item> <item name="
Android:paddingbottom ">2dp</item> <item name=" android:textsize ">20sp</item> </style> </resources> bg_titile 

Question 2 substitution method: Hide the title bar--Add in Androidmanifest-- android:theme= "@android: Style/theme.notitlebar" >

Mainactivity (question 3)

Package com.dragon.android.qqregist;
Import Android.annotation.SuppressLint;
Import android.app.Activity;
Import Android.graphics.Color;
Import Android.os.Bundle;
Import Android.view.View;
Import Android.widget.AdapterView;
Import Android.widget.AdapterView.OnItemSelectedListener;
Import Android.widget.Button;
Import Android.widget.CheckBox;
Import Android.widget.CompoundButton;
Import Android.widget.CompoundButton.OnCheckedChangeListener;
Import Android.widget.EditText;
Import Android.widget.Spinner;
Import Android.widget.Toast; public class Mainactivity extends activity {private Spinner Spinner = null; private edittext editText1; private Button bu
Tton2;
Private Button button1;
Private CheckBox CheckBox1; @Override protected void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (
R.layout.fragment_main);
Spinner = (spinner) Findviewbyid (R.id.spinner1);
Spinner.setselection (0);
EditText1 = (edittext) Findviewbyid (R.ID.EDITTEXT1); Edittext1.sethinTtextcolor (Color.gray);
Button2 = (Button) Findviewbyid (R.id.button2);
Set the space of the top Button2.bringtofront ();
Button1 = (Button) Findviewbyid (R.id.button1); Spinner Select Listener Event Spinner.setonitemselectedlistener (new Onitemselectedlistener () {@Override//parent Current spinner pos/ ID selected value location/Line public void onitemselected (adapterview<?> parent, view view, int POS, long ID) {//Get String-array Stri
ng[] Country = getresources (). Getstringarray (R.array.country);
Toast.maketext (Mainactivity.this, "you choose:" + Country[pos], toast.length_short). Show ();
@Override public void onnothingselected (adapterview<?> parent) {//Another interface Callback}});
CheckBox1 = (CheckBox) Findviewbyid (r.id.checkbox1); Checkbox1.setoncheckedchangelistener (New Oncheckedchangelistener () {@Override @SuppressLint ("Newapi") public void OnCheckedChanged (Compoundbutton view, Boolean inchecked) {button1.setenabled (inchecked); if (!inchecked) {//Set button background bu Tton1.setbackground (Getresources (). Getdrawable (r.drawable.bg_button));
else {Button1.setbackground (Getresources (). getdrawable (R.drawable.bg_button_change));}
}); }
}

The above is a small set to introduce the Android QQ user registration interface encountered problems and solutions, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

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.