Android之QQ新用户注册界面1
还没到睡觉时间所以再加了一个界面...

问题:
1、下拉列表(因为还没看到这里...)
2、标题栏显示问题
3、按钮的 Enable 设置
..........
以下是代码:
布局 fragment_main(问题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:layout_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"
android: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"/> <EditText
android:id="@+id/editText1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="2"
android:background="@drawable/bg_edittext"
android:ems="10"
android:inputType="phone"
android:hint="@string/innum"
android:color="#000000"
android:textSize="15sp" > </EditText> </LinearLayout> <Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_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" /> <CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android: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"
android: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" /> </RelativeLayout>
fragment_main
EditText、Spinner 以及 Button 修改前后的背景
<?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 的下拉数据 arrays
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="country">
<item >中国 +86</item>
<item >香港 +852</item>
<item >澳门 +853</item>
<item >台湾 +886</item>
<item >日本 +81</item>
<item >美国 +1</item>
<item >英国 +44</item>
</string-array>
</resources>
arrays
标题栏的背景(问题2 -- 放弃)
<?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用不了了,改不了颜色...
---------------------改是时候睡觉了...---------------------
Android之QQ新用户注册界面1的更多相关文章
- php创建新用户注册界面布局实例
php创建新用户注册界面布局实例 <!DOCTYPE> <html> <head> <title>Load page</title> < ...
- android 仿QQ气泡聊天界面
1.现在的QQ,微信等一些APP的聊天界面都是气泡聊天界面,左边是接收到的消息,右边是发送的消息, 这个效果其实就是一个ListView在加载它的Item的时候,分别用了不同的布局xml文件. 2.效 ...
- Android之QQ登录界面
首先过程中碰到的几个问题: 1.对 EditText 进行自定义背景 2.运行时自动 EditText 自动获得焦点 3.在获得焦点时即清空 hint ,而不是输入后清空 4.清空按钮的出现时机(在得 ...
- 安卓开发学习笔记(七):仿写腾讯QQ登录注册界面
这段代码的关键主要是在我们的相对布局以及线性布局上面,我们首先在总体布局里设置为线性布局,然后再在里面设置为相对布局,这是一个十分常见的XML布局模式. 废话不多说,直接上代码:一.activity. ...
- Atitit.android jsbridge v1新特性
Atitit.android jsbridge v1新特性 1. Java代码调用js并传参其实是通过WebView的loadUrl方法去调用的.只是参数url的写法不一样而已1 2. 三.JAVA ...
- Android系统在新进程中启动自定义服务过程(startService)的原理分析
在编写Android应用程序时,我们一般将一些计算型的逻辑放在一个独立的进程来处理,这样主进程仍然可以流畅地响应界面事件,提高用户体验.Android系统为我们提供了一个Service类,我们可以实现 ...
- iOS开发——实用篇Swift篇&QQ登入界面实现
QQ登入界面实现 我们知道在App Store中几乎所有软件都设计到账户的登入,而我们最常见的就是QQ,微信,在没有踏入程序员这条不归路之前,看到一个个的界面都感觉好高大上的样子. 在学习的过程中,自 ...
- 实现了在android实现左右滑动切换界面的效果
这是实现了在android实现左右滑动切换界面的效果,该效果的源码下载,请到源码天堂下载吧,喜欢的朋友可以研究一下. 布局文件 <?xml version="1.0" enc ...
- Android 6.0 新特性 整理 资料来自网络
Android 6.0新特性 Runtime Permissions Doze and App Standby Apache HTTP Client Removal BoringSSL Access ...
随机推荐
- sql 生成指定相同数量数据
select *from 表名 ,(SELECT NUMBER FROM master..spt_values WHERE number BETWEEN 1 AND 2 AND TYPE='P' ...
- c# 中int.ToString()的格式化的示例
格式化数值:有时,我们可能需要将数值以一定的格式来呈现,就需要对数值进行格式化.我们使用格式字符串指定格式.格式字符串采用以下形式:Axx,其中 A 为格式说明符,指定格式化类型,xx 为精度说明符, ...
- ssh base 写法
BaseDao package wl.oa.dao.base; public interface BaseDao<T>{ public void saveEntry(T t); } Bas ...
- Spring.NET 与 AOP 初窥1
(方面:如有错误,请勿喷,评论即可) 1.开始 什么是AOP?关于它的详细内容,可以自己用google搜索一下,能找到很多有趣的内容.事实上,现在的AOP只是对OOP的一个补充,还没有到达一个语言级别 ...
- php截取utf-8中文字符串乱码的解决方法
/** * PHP截取UTF-8字符串,解决半字符问题. * 英文.数字(半角)为1字节(8位),中文(全角)为2字节 * @return 取出的字符串, 当$len小于等于0时, 会返回整个字符串 ...
- 通过InputStream访问文件中的数据的四种方法
//方法一(每次只读取一个字节) public static void getFile() throws IOException { File file = new File("D:\\a. ...
- web.xml中在Servlet中获取context-param和init-param内的参数
引自:http://blog.csdn.net/yakson/article/details/9203231 web.xml里面可以定义两种参数:1.application范围内的参数,存放在serv ...
- Makefile 一点一滴(一)—— 从最简单的makefile模板写起
我在网上先找了一个最简单的makefile. 建立一个 TestCpp 目录,简单的写几行代码,命名为“TestCpp.cpp”,然后和这个最简单的 makefile 一起扔进去: TestCpp.c ...
- Android Fragment
1.Fragment必须是依存与Activity而存在的,因此Activity的生命周期会直接影响到Fragment的生命周期. 2.Fragment 生命周期: 首页 最新文章 在线课程 业界 开发 ...
- VMware下利用ubuntu13.04建立嵌入式开发环境之二
之前在VMware中安装完Ubuntu系统,接下来开始设置开发中用到的服务和工具,以及系统设计. 1.安装VMware工具:打开VMware软件,在菜单->VM->Install VMwa ...