部分总结

来源:互联网 发布:淘宝中老年衣服 编辑:程序博客网 时间:2024/05/21 20:29

在使用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);
当然这就必须要写下第二页面了,这就实现了页面的跳转。

原创粉丝点击