模拟QQ登陆器下载(模拟qq登陆)
你们好,最近小未来发现有诸多的小伙伴们对于模拟QQ登陆器下载,模拟qq登陆这个问题都颇为感兴趣的,今天小活为大家梳理了下,一起往下看看吧。
1、 首先,我们打开Android Studio,然后编写如下登录界面代码:
2、 ?xml version='1.0' encoding='utf-8'?
3、 TableLayout android:id='@+id/tableLayout1'
4、 android:layout_width='fill_parent'
5、 android:layout_height='fill_parent'
6、 xmlns:android='http://schemas.android.com/apk/res/android'
7、 android:gravity='center_vertical'
8、 android:stretchColumns='0,3'
9、
10、 !-第一行-
11、 TableRow android:id='@+id/tableRow1'
12、 android:layout_width='wrap_content'
13、 android:layout_height='wrap_content'
14、 TextView/
15、 TextView android:text='帐号:'
16、 android:id='@+id/textView1'
17、 android:layout_width='wrap_content'
18、 android:textSize='24px'
19、 android:layout_height='wrap_content'
20、 /
21、 EditText android:id='@+id/editText1'
22、 android:textSize='24px'
23、 android:layout_width='wrap_content'
24、 android:layout_height='wrap_content' android:minWidth='200px'/
25、 TextView /
26、 /TableRow
27、 !-第二行-
28、 TableRow android:id='@+id/tableRow2'
29、 android:layout_width='wrap_content'
30、 android:layout_height='wrap_content'
31、 TextView/
32、 TextView android:text='密码:'
33、 android:id='@+id/textView2'
34、 android:textSize='24px'
35、 android:layout_width='wrap_content'
36、 android:layout_height='wrap_content'/
37、 EditText android:layout_height='wrap_content'
38、 android:layout_width='wrap_content'
39、 android:textSize='24px'
40、 android:id='@+id/editText2'
41、 android:inputType='textPassword'/
42、 TextView /
43、 /TableRow
44、 !-第三行-
45、 TableRow android:id='@+id/tableRow3'
46、 android:layout_width='wrap_content'
47、 android:layout_height='wrap_content'
48、 TextView/
49、 Button android:text='登录'
50、 android:id='@+id/login'
51、 android:layout_width='wrap_content'
52、 android:layout_height='wrap_content'/
53、 Button android:text='退出'
54、 android:id='@+id/exit'
55、 android:layout_width='wrap_content'
56、 android:layout_height='wrap_content'/
57、 TextView /
58、 /TableRow
59、 /TableLayout
60、 然后我们编写成功登录的QQ界面代码(简单版):
61、 ?xml version='1.0' encoding='utf-8'?
62、 LinearLayout xmlns:android='http://schemas.android.com/apk/res/android'
63、 android:id='@+id/linearLayout1'
64、 android:orientation='vertical'
65、 android:layout_width='fill_parent'
66、 android:layout_height='fill_parent'
67、 LinearLayout
68、 android:id='@+id/linearLayout2'
69、 android:orientation='horizontal'
70、 android:layout_width='match_parent'
71、 android:layout_height='wrap_content'
72、 TextView
73、 android:id='@+id/nickname'
74、 android:layout_width='wrap_content'
75、 android:layout_weight='9'
76、 android:textSize='24px'
77、 android:padding='20px'
78、 android:layout_height='wrap_content'
79、 android:text='TextView' /
80、 Button
81、 android:id='@+id/m_exit'
82、 android:layout_weight='1'
83、 android:layout_width='wrap_content'
84、 android:layout_height='wrap_content'
85、 Android:text='注销'/
86、 /LinearLayout
87、 ListView
88、 android:id='@+id/listView1'
89、 android:entries='@array/option'
90、 android:layout_width='match_parent'
91、 android:layout_height='wrap_content'
92、 /ListView
93、 /LinearLayout
94、 然后我们编写登录帐户验证码:
95、 一、写一个final类,用来保存用户信息:
96、 package com.basillee.asus.myapplication.serversutil;
97、
100、 public final class Data {
101、 public static String[][]USERS={{'0001','123456','basillee'}
102、 ,{'0002','123456','basillee2'},{'0003','123456','basillee3'}};
103、 }
104、 然后我们编写并验证用户输入的账户密码,实现跳转到状态页面:
105、 private void testImitateQQ(){
106、 Button login=(Button)findViewById(R.id.login);
107、 Button exit=(Button)findViewById(R.id.exit);
108、 login.setonClickListener(new View.onClickListener() {
109、 @Override
110、 public void onClick(View v) {
111、 String number=((EditText)findViewById(R.id.editText1)).getText().toString();
112、 String password=((EditText)findViewById(R.id.editText2)).getText().toString();
113、 boolean flag=false;
114、 String nickName='';
115、 for(int i=0;i Data.USERS.length;i++){
116、 if(number.equals(Data.USERS[i][0])){
117、 if(password.equals(Data.USERS[i][1])){
118、 nickName=Data.USERS[i][2];
119、 flag=true;
120、 break;
121、 }
122、 }
123、 }
124、 if(flag){
125、 Intent intent=new Intent(MainActivity.this,ImitateQQ.class);
126、 Bundle bundle=new Bundle();
127、 bundle.putString('nickName',nickName);
128、 intent.putExtras(bundle);
129、 startActivity(intent);
130、 }else{
131、 Toast.makeText(getApplicationContext(),'wrong account or password',Toast.LENGTH_LONG).show();
132、 }
133、 }
134、 });
135、 exit.setonClickListener(new View.onClickListener() {
136、 @Override
137、 public void onClick(View v) {
138、 finish();
139、 }
140、 });
141、 }
142、 然后,我们在QQ登录后编写状态页面,从登录页面接受用户名并显示:
143、 Button button=(Button)findViewById(R.id.m_exit);
144、 button.setonClickListener(new View.onClickListener() {
145、 @Override
146、 public void onClick(View v) {
147、 finish();
148、 }
149、 });
150、 Intent intent=getIntent();
151、 Bundle bundle=intent.getExtras();
152、 String nickName=bundle.getString('nickName');
153、 TextView textView=(TextView)findViewById(R.id.nickname);
154、 textView.setText('User:'+nickName);
155、 然后我们可以点击运行测试程序,运行如下:
156、 我会继续更新我个人的Android学习经验,欢迎大家的持续关注。投一个喜欢的朋友就好了。
以上就是模拟qq登陆这篇文章的一些介绍,希望对大家有所帮助。
免责声明:本文章由会员“刘龙远”发布如果文章侵权,请联系我们处理,本站仅提供信息存储空间服务如因作品内容、版权和其他问题请于本站联系