最近在玩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. Maven模块化搭建总结

    1.Maven插件在eclipse的安装 windows——>preferences——>Maven——>installations——>add——>installati ...

  2. Topcoder10566 IncreasingNumber

    IncreasingNumber 一个数是Increasing当且仅当它的十进制表示是不降的,\(1123579\). 求 \(n\) 位不降十进制数中被 \(d\) 整除的有多少个. \(n\leq ...

  3. TreeMap 的简单解释

    TreeMap的构造函数   可以传入 自定义的比较器.Map.SortedMap.   put方法: public V put(K key, V value) { Entry<K,V> ...

  4. AtCoder Beginner Contest 127 解题报告

    传送门 非常遗憾.当天晚上错过这一场.不过感觉也会掉分的吧.后面两题偏结论题,打了的话应该想不出来. A - Ferris Wheel #include <bits/stdc++.h> u ...

  5. 基于VS2017+ROS的ROSOnWindows开坑之旅

    前面尝试了很多算法之后,得先找个能用的环境跑起来试试,于是决定尝试下ROS环境,但是我一直没有尝试Windows版也是因为这个原因,坑太多了,不过现在找到了微软IoT移植的ROSOnWindows,并 ...

  6. siameseNet网络以及信号分类识别应用

    初学siameseNet网络,希望可以用于信号的识别分类应用.此文为不间断更新的笔记. siameseNet简介 全连接孪生网络(siamese network)是一种相似性度量方法,适用于类别数目多 ...

  7. JavaScript基础02-条件语句及介绍函数

    条件语句 if  和  if - else  语句 if(你还没睡着么?){ 是 那我们去撸串--- } 当条件判断为真true时,执行花括号内的语句,如果条件为假false,跳过花括号内的语句 if ...

  8. 洛谷 P1379 八数码难题 题解

    我个人感觉就是一道bfs的变形,还是对bfs掌握不好的人有一定难度. 本题思路: 大体上用bfs搜,用map来去重,在这里只需要一个队列,因为需要较少步数达到的状态一定在步数较多的状态之前入队列. # ...

  9. [THUPC2019]不等式/[51Nod1598]方程最小值

    [THUPC2019]不等式/[51Nod1598]方程最小值 题目大意: 给定\(a_{1\sim n}\)和\(b_{1\sim n}\),令\(f_k(x)=\sum_{i=1}^k|a_ix+ ...

  10. 用Xpath选择器解析网页(lxml)

    在<爬虫基础以及一个简单的实例>一文中,我们使用了正则表达式来解析爬取的网页.但是正则表达式有些繁琐,使用起来不是那么方便.这次我们试一下用Xpath选择器来解析网页. 首先,什么是XPa ...