【Android Studio】Android实现跳转功能
最近在玩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实现跳转功能的更多相关文章
- [Android Studio] Android Studio常用快捷键
[Android Studio] Android Studio常用快捷键 (会持续更新)这边讲的常用快捷键是指做完Keymap到Eclipse后的,不是纯Android Studio的,这边主要讲 ...
- [Android Studio] Android studio 多渠道打包(超简洁版)
[Android Studio] Android studio 多渠道打包(超简洁版) 转载:http://xuyazhou.com/archives/461 http://relex.me/usin ...
- Android Studio 代码页跳界面 /java和XML快速切换技巧
https://www.cnblogs.com/simadi/p/6698666.html?utm_source=itdadao&utm_medium=referral 今天又发现了一个And ...
- [Android] android studio 2.0即时运行功能探秘
即时运行instant Run是android studio 2中,开发人员最关心的特性之一 在google发布studio 2.0之后,马上更新体验了一把,然而发现,并没快多少,说好的即时运行呢? ...
- [Android Studio] Android Studio快速定位当前打开的文件在哪个目录(package)下
转载自:http://blog.csdn.net/hyr83960944/article/details/38067499 在Eclipse中有一个很好的功能,就是比如我打开一个AActivity,左 ...
- [Android Studio] Android Studio中查看类的继承关系
转载自:http://blog.csdn.net/hyr83960944/article/details/38098091 查看类的继承关系的快捷键F4,在Android Studio常用快捷键这篇文 ...
- [Android Studio] Android Studio如何提示函数用法
Eclipse有一个很好的功能,就是当你代码调用某个android API时,鼠标移到对应的函数或者方法上,就会自动有一个悬 浮窗提示该函数的说明(所包含的参数含义,该方法功能).迁移到Android ...
- [Android Studio] Android Studio使用教程(一)
转载:http://blog.csdn.net/hyr83960944/article/details/37509113 今年的Google全球开发者 大会虽然没有新的Android系统和设备,但是还 ...
- [Android Studio] Android Studio快速定位当前打开的文件在哪个目录(package)下
转载自:http://blog.csdn.net/hyr83960944/article/details/38067499 在Eclipse中有一个很好的功能,就是比如我打开一个AActivity,左 ...
- [Android Studio] Android Studio如何快速生成get,set,tostring,构造函数
刚开始使用Android Studio时,在创建一个javabean时,很习惯的在JavaBean类中,右键去找生成get,set等选项.但是很遗憾,找不到. 那这边如何快速的set,get或者生成构 ...
随机推荐
- java 第11次作业
题目1:编写一个应用程序,统计输入的一个字符串中相同字符的个数,并将统计结果输出. 代码 import java.util.*; public class Test { public static v ...
- c#中的多态学习总结
c#的多台方法,大体上和c++的类似,但是有点区别的,我这里刚刚初学,因此把重点记录下. 多态是同一个行为具有多个不同表现形式或形态的能力. 多态性意味着有多重形式.在面向对象编程范式中,多态性往往表 ...
- 公告 & 备注
公告 这个\(blog\)从\(2019.12.21\)正式开始使用. 之前的博客请出门右转链接: \[\Large\texttt{my blog}\] \(:)\) 备注 近期要学的算法qwq \( ...
- 002——keil-Error: L6915E: Library reports error: __use_no_semihosting was requested解决
..\OBJ\KEY.axf: Error: L6915E: Library reports error: __use_no_semihosting was requested, but _ttywr ...
- 非旋转 treap
其实之前学过一次非旋转 treap,但是全忘光了,今天复习一下. 洛谷 P3369 [模板]普通平衡树 code: #include <bits/stdc++.h> #define N 1 ...
- javascript 终极循环方法for... of ..推荐
js目前有很多的循环方法,如for, forEach, for .. in, for of 等等,而在ES6里面,我们又增加了一些数据结构,比如set,map,Symbol等. 那么我们该选取哪一 ...
- 中断点异常 STATUS_BREAKPOINT(0x80000003)
简介 STATUS_BREAKPOINT,值为0x80000003,称为中断指令异常,表示在系统未附加内核调试器时遇到断点或断言. 触发条件 通常中断指令异常可以在以下条件下触发: 硬代码中断请求,如 ...
- 使用 DML 自定义调试器输出
调试器标记语言 (DML) 提供了一种机制增强来自调试器和扩展的输出. 与 HTML 类似,调试器的标记支持允许将输出包括显示指令和额外非显示的标记窗体中的信息. 调试器用户界面,WinDbg 等中分 ...
- Postgresql 数据库迁移步骤
1.操作位置:迁移数据库源(旧数据库主机) 找到PostgreSql 的data目录 关闭数据库进程 打包 tar -zcvf pgdatabak.tar.gz data/ ----------- ...
- 【转】Resource Localization in YARN
一个Applciation运行在YARN上的流程为,从YARN Client向ResourceManager提交任务,将Applciation所需资源提交到HDFS中,然后ResourceManage ...