在使用Android Studio时用到的知识

隐藏标题栏

部分总结

方法一:在java语言编写页面(src-java)输入以下代码:

                  if(getSupportActionBar()!=null){

                      getSupportActionBar().hide;

                  }

方法二:在src-res-values-styles.xml页面将<style name.. 一栏改为:

               <style name="App Theme" parent="Theme.AppCompat.Light.NoActionBar">


提示文字

部分总结

在显示模块<LinearLayout-<EditText中填入android:hint="要提示的文字内容"

记住密码

在编写xml 页面输入以下内容:

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">
    <CheckBox
        android:id="@+id/remember_pass"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textSize="18sp"
        android:text="记住密码"/>
</LinearLayout>
即可实现记住密码功能,下次进入时不需要再次输入密码。
跳转页面
点击一个按钮实现页面跳转,这就需要按钮的监听,从而实现页面跳转。
例如在上例图片中点击注册实现按钮。
我们需要在java语言编写页面写下以下代码:
先在public void onCreate(Bundle savedInstanceState) {之中写下:

Button button1 = (Button) findViewById(R.id.login);

button1.setOnClickListener(this);
然后在public void onClick(View v) {中写下:
Intent intent=new Intent(MainActivity.this,Main2Activity.class);
startActivity(intent);
当然这就必须要写下第二页面了,这就实现了页面的跳转。

相关文章: