您的位置:首页 > 移动开发 > Android开发

Android之QQ新用户注册界面1

2016-09-01 00:40 302 查看
还没到睡觉时间所以再加了一个界面...

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://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
问题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));
}
}
});
}
}


图片素材

aa.png

-- ps用不了了,改不了颜色...

---------------------改是时候睡觉了...---------------------
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: