手机页面的切换
来源:互联网 发布:matlab 2017b mac 编辑:程序博客网 时间:2024/05/02 00:55
package com.wzc.ex03_08;import android.support.v7.app.AppCompatActivity;import android.os.Bundle;import android.view.View;import android.widget.Button;public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button b1= (Button) findViewById(R.id.bt_1); b1.setOnClickListener(new Button.OnClickListener(){ @Override public void onClick(View view) { jumpToLayout2(); } }); } private void jumpToLayout2() { setContentView(R.layout.mylayout); Button b2 = (Button) findViewById(R.id.bt_2); b2.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View view) { jumpToLayout1(); } }); } private void jumpToLayout1() { setContentView(R.layout.activity_main); Button b1 = (Button) findViewById(R.id.bt_1); b1.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View view) { jumpToLayout2(); } }); }}
<?xml version="1.0" encoding="utf-8"?><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:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:background="@drawable/black" tools:context="com.wzc.ex03_08.MainActivity"> <TextView android:id="@+id/tv_1" android:textSize="24sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/layout1" /> <Button android:id="@+id/bt_1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Go to layout2" android:layout_below="@+id/tv_1" android:layout_alignParentStart="true" /></RelativeLayout><?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/white" android:orientation="vertical" > <TextView android:id="@+id/tv_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/layout2" android:textSize="24sp" /> <Button android:id="@+id/bt_2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@drawable/black" android:text="Go to layout1" /></LinearLayout>
0 0
- 手机页面的切换
- 手机页面的切换(setContentView的应用)
- 切换手机的输入法
- 页面位置的切换
- Flex页面的切换
- 页面的切换效果
- Fragment页面的切换
- angular的切换页面
- 手机网站的切换跳转
- 手机网站的切换跳转
- 手机页面的rem
- 2.手机竖直方向实现循环切换页面
- Android UI(编辑手机信息页面,中英文切换)
- 手机端和平PC端页面切换以及数据传递
- 栈在Android手机APP页面切换中的应用
- 手机端滑动实现页面左右切换效果
- sohu切换页面的脚本
- Eclipse 切换页面的Key
- 2016.8.28 随写
- 越过Android中布局文件中使用onClick属性的坑
- 2016.8.29 解题报告之我会做的题都是简单题
- mysql忘记root密码
- 2016.8.29 LGTB解题报告
- 手机页面的切换
- 第十周项目2-二叉树遍历的递归算法
- 2016.9.3 好好学习天天快乐解题报告
- 【BZOJ】3992 [SDOI2015]序列统计 【离散对数下的NTT】
- 维护篇(5.2)-08. 批量命令操作 ❀ 飞塔 (Fortinet) 防火墙
- 《将博客搬至CSDN》
- 动态include与静态include的区别
- 深入字节码 -- 计算方法执行时间(ONE APM基础原理窥探)
- 【前端笔试题】数组去重