strings.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Walker</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="etName">请输入账号</string>
<string name="etPassword">请输入密码</string>
<string name="btnLogin">登录</string>
<string name="btnRegiste">注册</string>
<string name="tvForgetpass"><u>忘记密码</u></string>
<string name="etAccountrHint">账号</string>
<string name="etNickHint">昵称</string>
<string name="etPasswordHint">密码</string>
<string name="etMotto">座右铭(不多于8个字)</string>
<string name="etEmail">邮箱(**@**.com)</string>
<string name="etCity">城市</string>
<string name="etStep">步长(cm)</string>
<string name="etHeight">身高(cm)</string>
<string name="etWeight">体重(kg)</string>
<string name="etExceptSteps">期望运动量(步/日)</string>
<string name="tvRegistFinish">哎,终于填完资料了,真不容易,谢谢亲的支持,么么哒</string>
<string name="title_activity_regist">RegistActivity</string>
</resources>
RegistActivity.java
package cn.bzu.bztc.walker;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.Window;
public class RegistActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_regist);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.regist, menu);
return true;
}
}
activity_regist.xml
由于注册界面内容很多,一屏幕显示不下,所以最外层使用 ScrollView 控件,当控件显示不开时会出现垂直方向的滚动条。
<ScrollView 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:background="@drawable/logintophb_roundcorner" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/logintophb_roundcorner"
android:orientation="vertical"
android:padding="10dp"
tools:context=".RegistActivity"
>
<com.makeramen.roundedimageview.RoundedImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/roundedImage_head"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_gravity="center_horizontal"
android:onClick="changePhoto"
app:riv_border_color="#333333"
app:riv_border_width="3dip"
app:riv_corner_radius="10dip"
app:riv_mutate_background="true"
app:riv_oval="true"
android:src="@drawable/test_photo" />
<EditText
android:id="@+id/etAccount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/etaccount"
android:hint="@string/etAccountrHint"
android:ems="10" >
</EditText>
<EditText
android:id="@+id/etNick"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/etnick"
android:hint="@string/etNickHint"
android:ems="10" >
</EditText>
<EditText
android:id="@+id/etPassword"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/etpassword"
android:hint="@string/etPasswordHint"
android:inputType="textVisiblePassword"
android:ems="10" >
</EditText>
<EditText
android:id="@+id/etMotto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/etmotto"
android:hint="@string/etMotto"
android:ems="10" >
</EditText>
<EditText
android:id="@+id/etEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/etemail"
android:hint="@string/etEmail"
android:inputType="textEmailAddress"
android:ems="10" >
</EditText>
<EditText
android:id="@+id/etCity"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/etcity"
android:hint="@string/etCity"
android:ems="10" >
</EditText>
<View android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@android:color/darker_gray"/>
<EditText
android:id="@+id/etfoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/etfoot"
android:hint="@string/etStep"
android:inputType="number"
android:ems="10" >
</EditText>
<EditText
android:id="@+id/etHeight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/etheight"
android:hint="@string/etHeight"
android:inputType="number"
android:ems="10" >
</EditText>
<EditText
android:id="@+id/etWeight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/etweight"
android:hint="@string/etWeight"
android:inputType="number"
android:ems="10" >
</EditText>
<EditText
android:id="@+id/etExceptSteps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@android:drawable/edit_text"
android:drawableLeft="@drawable/etexceptsteps"
android:hint="@string/etExceptSteps"
android:inputType="number"
android:ems="10" >
</EditText>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/tvRegistFinish" />
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:background="@drawable/btn_select"
android:layout_marginTop="5dp"
android:text="@string/btnRegiste" />
</LinearLayout>
</ScrollView>
常规信息下的横线生成
<View android:layout_width="match_parent"
android:layout_height="20dp"
android:background="@android:color/darker_gray"/>