在app文件夹上右键新建空的activity ,名称为DisplayMessageActivity,

修改layout文件夹下activity_display_message.xml

<?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:orientation="vertical"
> <TextView
android:id="@+id/ttv1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="edit_message"
android:textColor="#5500FF"
android:textSize="32sp"
android:padding="10dp"
/> <TextView
android:id="@+id/ttv2"
android:layout_width="355dp"
android:layout_height="wrap_content"
android:maxLines=""
android:ellipsize="end"
android:padding="10dp"
android:text="what are you going to do"
android:textColor="#00FF55"
android:textSize="32sp"
/> <TextView
android:id="@+id/ttv3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="More Info"
android:textSize="32sp"
android:padding="10dp"
/> </LinearLayout>

修改activity_main.xml

<?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:orientation="vertical"> <Button
android:id="@+id/btnTextView1"
android:layout_width="223dp"
android:layout_height="69dp"
android:text="TestTextView" /> </LinearLayout>
修改MainActivity.java
package com.example.myapplication;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button; public class MainActivity extends AppCompatActivity { private Button mBtnTextView; // define a text view button
@Override
protected void onCreate(Bundle x) {
super.onCreate(x);
setContentView(R.layout.activity_main);
mBtnTextView = findViewById(R.id.btnTextView1); // get the button, it is in activity_main.xml
mBtnTextView.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent intent = new Intent(MainActivity.this, DisplayMessageActivity.class);
startActivity(intent);
}
});
};
}

修改DisplayMessageActivity.java

package com.example.myapplication;

import android.graphics.Paint;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView; public class DisplayMessageActivity extends AppCompatActivity { private TextView mtv1;
@Override
protected void onCreate(Bundle x) {
super.onCreate(x);
setContentView(R.layout.activity_display_message);
mtv1 = findViewById(R.id.ttv1);
mtv1.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); // set strike through style
mtv1.getPaint().setAntiAlias(true); // get rid of the zigzag effect
}
}

修改AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplication"> <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"> <activity android:name=".DisplayMessageActivity"
android:parentActivityName=".MainActivity" >
<!-- The meta-data tag is required if you support API level and lower -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".MainActivity" />
</activity> <activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity> </application> </manifest>

点击运行!

activity 的跳转的更多相关文章

  1. Android课程---Activity的跳转与传值(转自网上)

    Activity跳转与传值,主要是通过Intent类来连接多个Activity,以及传递数据.   Intent是Android一个很重要的类.Intent直译是“意图”,什么是意图呢?比如你想从这个 ...

  2. Android activity界面跳转动画

    实现activity界面跳转动画 1.在startActivity方法之后加入: overridePendingTransition(R.anim.pull_in_right, R.anim.pull ...

  3. Activity的跳转与传值(转载)

    Activity跳转与传值,主要是通过Intent类来连接多个Activity,以及传递数据.   Intent是Android一个很重要的类.Intent直译是“意图”,什么是意图呢?比如你想从这个 ...

  4. android入门:activity之间跳转,并且回传参数

    介绍:         两个activity进行跳转,在跳转过程中,将message由MainActivity传递到secondActivity,并且当secondActivity退回至MainAct ...

  5. Activity的跳转与传值

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://android.blog.51cto.com/268543/323982 Acti ...

  6. Activity基本跳转

    详细解释:http://blog.csdn.net/xiazdong/article/details/7664757 简单介绍activity的跳转,通过intent实现,详细的注释在代码中.涉及到a ...

  7. Activity A 跳转到Activity B 生命周期

    又被生命周期折磨了一段时间,这次是被onPause 和 onStop 折磨了,一直认为Activity A 跳转到到 Activity B的生命周期是onPause(A),onStop(A),onCr ...

  8. Android Activity间跳转与传递数据

    1 概述 Activity之间的跳转主要使用 startActivity(Intent intent); startActivityForResult(Intent intent,int reques ...

  9. 5.10学习总结——Activity的跳转和传值

    使用sharedpreference是对信息的存储,也可以进行传值,今天通过查找资料,学习了Activity的跳转和传值方法. 跳转 1.显示跳转 4种方法 1 2 3 4 5 6 7 8 9 10 ...

  10. 关于从Activity A跳转到Activity B ,其中Activity A中有一个VideoView,Activity B中有一个MediaPlayer。

    两个不同的视频的跳转, 前面我是在onStop()方法中销毁VideoView(因为MediaPlayer是全局共用的,而VideoView内包含MediaPlayer),但是每次进入Activity ...

随机推荐

  1. GoldenGate实时投递数据到大数据平台(5) - Kafka

    Oracle GoldenGate是Oracle公司的实时数据复制软件,支持关系型数据库和多种大数据平台.从GoldenGate 12.2开始,GoldenGate支持直接投递数据到Kafka等平台, ...

  2. Oracle初级第一天

    oracle卸载 运行regedit,删除HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ ...

  3. sqlite3增删改查简单封装

    import sqlite3 class DBTool(object): def __init__(self): """ 初始化函数,创建数据库连接 "&quo ...

  4. Linux 流量监控工具 iftop

    Linux 流量监控工具 iftop Iftop工具主要用来显示本机网络流量情况及各相互通信的流量集合,如单独同哪台机器间的流量大小,非常适合于代理服务器和iptables服务器使用,这样可以方便的查 ...

  5. golang中tcp socket粘包问题和处理

    转自:http://www.01happy.com/golang-tcp-socket-adhere/ 在用golang开发人工客服系统的时候碰到了粘包问题,那么什么是粘包呢?例如我们和客户端约定数据 ...

  6. axure rp 8.0注册码(亲测)

    今天在看一需求原型时,发现其他部门发过来是8.0版的,老的7不能用,找了个亲测可用的验证码. License:米 业成 (STUDENT)Key:nFmqBBvEqdvbiUjy8NZiyWiRSg3 ...

  7. mongodb三种引擎测试(转)

    文章http://diyitui.com/content-1459560904.39084552.html亲测了根据证券行情存储的性能情况,我们目前使用load local infile,平均每秒更新 ...

  8. Java版 家政服务 社区服务 家装服务平台 源码 有案例 可定制

    产品说明: 家装服务平台.社区服务平台.服务类型的平台--公司成熟产品 包括工匠注册.资质认证.发布服务产品.会员注册.预约服务.工匠定价.执行服务.服务完毕填写工作日志上传现场照片.会员确认服务.返 ...

  9. win7 powershell配色方案

    首先我是参考微软的word的, look~ Windows PowerShell 配置文件 要配置powershell很简单, 就几步 1.显示 Windows PowerShell 配置文件的路径 ...

  10. you must restart adb and eclipse的相关解决办法

    问题是5037端口被占用: C:\>netstat -aon|findstr "5037" 看到了吗,端口被进程号为5037的进程占用,继续执行下面命令(也可以去任务管理器中 ...