最近在玩Esp32,需要APP,顺带学了下这方面的东西。

主要实现功能: 从主  mainActivity  跳转到otherActivity。

新建一个hello工程,添加 otherActivity 和 otherxml.xml;

mainActivity内容:

package com.example.xiaoyehack.test;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; import android.view.View;
import android.content.Intent; public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
} public void skip(View view){
Intent intent = new Intent();
intent.setClass(MainActivity.this,otherActivity.class);
startActivity(intent);
}
}

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"> <Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="79dp"
android:layout_marginStart="148dp"
android:layout_marginTop="32dp"
android:layout_marginEnd="148dp"
android:layout_marginBottom="276dp"
android:onClick="skip"
android:text="点击跳转"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView3" /> <TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="122dp"
android:layout_marginTop="105dp"
android:layout_marginEnd="122dp"
android:layout_marginBottom="92dp"
android:text="点击下面按钮实现跳转"
app:layout_constraintBottom_toTopOf="@+id/button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout>

  

otherActivity内容:
package com.example.xiaoyehack.test;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; public class otherActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.otherxml);
} }

  otherxml内容:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"> <TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="67dp"
android:layout_marginStart="116dp"
android:layout_marginTop="146dp"
android:layout_marginEnd="100dp"
android:layout_marginBottom="346dp"
android:text="不要吹牛皮,就是一把梭!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</android.support.constraint.ConstraintLayout>

赏币地址:

https://download.csdn.net/download/qq_18187161/10882442

无币地址:

链接:https://pan.baidu.com/s/1NWPNbkQxMgkGxpNPX9loLw
提取码:qhnx
提取码复制可见。

【Android Studio】Android实现跳转功能的更多相关文章

  1. [Android Studio] Android Studio常用快捷键

    [Android Studio] Android Studio常用快捷键   (会持续更新)这边讲的常用快捷键是指做完Keymap到Eclipse后的,不是纯Android Studio的,这边主要讲 ...

  2. [Android Studio] Android studio 多渠道打包(超简洁版)

    [Android Studio] Android studio 多渠道打包(超简洁版) 转载:http://xuyazhou.com/archives/461 http://relex.me/usin ...

  3. Android Studio 代码页跳界面 /java和XML快速切换技巧

    https://www.cnblogs.com/simadi/p/6698666.html?utm_source=itdadao&utm_medium=referral 今天又发现了一个And ...

  4. [Android] android studio 2.0即时运行功能探秘

    即时运行instant Run是android studio 2中,开发人员最关心的特性之一 在google发布studio 2.0之后,马上更新体验了一把,然而发现,并没快多少,说好的即时运行呢? ...

  5. [Android Studio] Android Studio快速定位当前打开的文件在哪个目录(package)下

    转载自:http://blog.csdn.net/hyr83960944/article/details/38067499 在Eclipse中有一个很好的功能,就是比如我打开一个AActivity,左 ...

  6. [Android Studio] Android Studio中查看类的继承关系

    转载自:http://blog.csdn.net/hyr83960944/article/details/38098091 查看类的继承关系的快捷键F4,在Android Studio常用快捷键这篇文 ...

  7. [Android Studio] Android Studio如何提示函数用法

    Eclipse有一个很好的功能,就是当你代码调用某个android API时,鼠标移到对应的函数或者方法上,就会自动有一个悬 浮窗提示该函数的说明(所包含的参数含义,该方法功能).迁移到Android ...

  8. [Android Studio] Android Studio使用教程(一)

    转载:http://blog.csdn.net/hyr83960944/article/details/37509113 今年的Google全球开发者 大会虽然没有新的Android系统和设备,但是还 ...

  9. [Android Studio] Android Studio快速定位当前打开的文件在哪个目录(package)下

    转载自:http://blog.csdn.net/hyr83960944/article/details/38067499 在Eclipse中有一个很好的功能,就是比如我打开一个AActivity,左 ...

  10. [Android Studio] Android Studio如何快速生成get,set,tostring,构造函数

    刚开始使用Android Studio时,在创建一个javabean时,很习惯的在JavaBean类中,右键去找生成get,set等选项.但是很遗憾,找不到. 那这边如何快速的set,get或者生成构 ...

随机推荐

  1. waitpid()函数

    waitpid函数 作用同于wait,但可指定pid进程清理,可以不阻塞. pid_t waitpid(pid_t pid,int *status,int options);成功:返回清理掉的子进程I ...

  2. jquery easyui 1.3.4 datagrid pageNumber 設置導致兩次請求的解决方案

    $('#table').datagrid({ url: '/get/data/path/to/your/server', pageNumber: , pageSize: , ... }); 當手動設置 ...

  3. Linux——安装并配置Kafka

    前言 Kafka是由Apache软件基金会开发的一个开源流处理平台,由Scala和Java编写.Kafka是一种高吞吐量的分布式发布订阅消息系统,它可以处理消费者规模的网站中的所有动作流数据. 这种动 ...

  4. 解读 v8 排序源码

    前言 v8 是 Chrome 的 JavaScript 引擎,其中关于数组的排序完全采用了 JavaScript 实现. 排序采用的算法跟数组的长度有关,当数组长度小于等于 10 时,采用插入排序,大 ...

  5. Random Walk——高斯消元法

    题目 有一个 $N \times M$ 大小的格子,从(0, 0)出发,每一步朝着上下左右4个格子中可以移动的格子等概率移动.另外有些格子有石头,因此无法移至这些格子.求第一次到达 $(N-1, M- ...

  6. java接口的成员变量的修饰符

    前言:c++学的java都忘记了不少 interface(接口)可将其想象为一个"纯"抽象类.它允许创建者规定一个类的基本形式:方法名.自变量列表以及返回类型,但不实现方法主体 接 ...

  7. SpringBoot整合JDBC模板

    目录 Grade实体类 public class Grade { private Integer gradeId; private String gradeName; public Grade(){ ...

  8. Vue.directive全局自定义指令案例

    今天正好这个知识点有点淡忘了,就随笔一下吧: Vue.directive(参数1,参数2) 参数1:指令名称,如"drag" 参数2:指令要实现的回调函数,其中回调函数中也有两个参 ...

  9. PHP生成随机数;订单号唯一

    //8-12位随机数 function makeRand($num=){ $strand = (; if(strlen($strand)<$num){ $strand = str_pad($st ...

  10. [内网渗透] MSF路由转发/网络代理

    这里只做记录,不做详解 0x01 路由转发 已经拿到一台公网服务器: 1.1 方法1 进到meterpreter的会话: route #查看路由信息 background退出当前会话,通过会话2,转发 ...