栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 移动开发 > Android

Android QQ新用户注册界面绘制

Android 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Android QQ新用户注册界面绘制

本文实例为大家分享了Android QQ新用户注册界面绘制代码,供大家参考,具体内容如下

先看看效果图:

问题: 

1、下拉列表(因为还没看到这里...)

2、标题栏显示问题

3、按钮的 Enable 设置

   .......... 

以下是代码:

布局 fragment_main(问题1)



 

EditText、Spinner 以及 Button 修改前后的背景

1.bg_edittext



 
 
 
 
 
 


2.bg_spinner



 
 
 
 
 
 


3.bg_button



 
 
 
 
 
 


4.bg_buttin_change



 
 
 
 
 
 


Spinner 的下拉数据 arrays



 
 中国 +86
 香港 +852
 澳门 +853
 台湾 +886
 日本 +81
 美国 +1
 英国 +44
 

标题栏的背景(问题2 -- 放弃)



 
 
 @style/Titleground
 @style/windowTitleStyle
 40dp 
 
 
  
 #FFFFFF 
 
 
 
 @string/pagename
 #1CBAF5 
 2dp
 2dp
 20sp
 
 

问题2替换方法:隐藏标题栏 -- 在 AndroidManifest 中添加 -- android:theme="@android:style/Theme.NoTitleBar" > 

MainActivity (问题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 button2;
 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);
 // 设置空间置顶
 button2.bringToFront();
 button1 = (Button) findViewById(R.id.button1);

 // spinner 选择监听事件
 spinner.setonItemSelectedListener(new onItemSelectedListener() {

  @Override
  // parent当前spinner pos/id选中的值所在位置/行
  public void onItemSelected(AdapterView parent, View view,
   int pos, long id) {
  // 得到string-array
  String[] country = getResources().getStringArray(
   R.array.country);
  Toast.makeText(MainActivity.this, "你选择的是:" + 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) {
   // 设置按钮的背景
   button1.setBackground(getResources().getDrawable(
    R.drawable.bg_button));
  } else {
   button1.setBackground(getResources().getDrawable(
    R.drawable.bg_button_change));
  }
  }
 });
 }
}

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/161545.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号