android屏幕页面实现滚动,页面跳转
在
在LinearLayout外面包一层ScrollView即可,如下代码
Apidemo 中关于如何使用ScrollView说明,请参考:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<LinearLayout
android:id="@+id/layout"
android:orientation="vertical"
android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/scroll_view_1_text_1"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/scroll_view_1_button_1"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/scroll_view_1_text_6"/>
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/scroll_view_1_button_6"/>
</LinearLayout>
</ScrollView>
2:页面跳转的实现(不同activity间的切换)
java代码 加在button哪里同时在AndroidManifest.xml 哪里加上一句话,放在第一个activity 的下面
xml:代码:
<activity android:name="BCD" android:label="@string/bcd_title"></activity>
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0" package="com.demo.android.AutoGnosis">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".AutoGnosis"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="BCD" android:label="@string/bcd_title"></activity> //添加标签属性与values/report.xml对应
</application>
<uses-sdk android:minSdkVersion="3" />
</manifest>
跳转代码:
private void setListensers() {
Log.d(TAG,"set Listensers");
button_next.setOnClickListener(bt_next);
}
private Button.OnClickListener bt_next = new Button.OnClickListener(){
public void onClick(View v){
//switch to BDC page跳转到BDC.class
Intent intent = new Intent();
intent.setClass(AutoGnosis.this, BCD.class);
startActivity(intent);
Intent intent = new Intent();
intent.setClass(Bmi.this, Report.class);
Bundle bundle = new Bundle(); //bundle带参数跳转
bundle.putString("KEY_HEIGHT",field_height.getText().toString());
bundle.putString("KEY_WEIGHT",field_weight.getText().toString());
intent.putExtras(bundle);
startActivity(intent);
}
};
android屏幕页面实现滚动,页面跳转的更多相关文章
- vue使用原生js实现滚动页面跟踪导航高亮
需要使用vue做一个专题页面. 滚动页面指定区域导航高亮. BetterScroll:可能是目前最好用的移动端滚动插件 如何自定义CSS滚动条的样式? 监听滚动页面事件,对比当前页面的位置与元素的位置 ...
- vue2.0 页面A跳转到页面B,B页面停留在A页面的滚动位置的解决方法
如果页面A沿Y轴滚动一段距离,然后跳转到页面B: 在进入B页面时,B页面已经滚到页面A的距离,返回页面A,发现A还在之前的滚动位置: 这样体验就很不好,所以我们要进行一些处理: 我的方法是:在路由守卫 ...
- vue滚动行为控制——页面跳转返回上一个页面保留滚动位置
需求分析: 一般这个功能在后台管理系统用的比较多,因为后台页面都是在当前页面打开,对于某些列表筛选页,如果列表数据比较多,页面就会滚动.当页面发生滚动,对列表数据进行查看或者编辑的时候,跳转到下一级页 ...
- Android 完美解决bundle实现页面跳转并保留之前数据+传值
1.前言 前言: 昨天碰到了一个问题,我想实现页面跳转,采用了Bundle之后,再回到原来的页面,发现数据也没有了, 而且一直报错,网上查找了很多资料,发现要用一个startActivityForRe ...
- Android滚动页面位置指示器:CircleIndicator
Android滚动页面位置指示器:CircleIndicator CircleIndicator是github上的一个开源的用于页面滚动时候的位置指示器,指示当前页面在总的页面中的位置和前后位置 ...
- 移动端touch事件影响click事件以及在touchmove添加preventDefault导致页面无法滚动的解决方法
这两天自己在写一个手机网页,用到了触屏滑动的特效,就是往右滑动的时候左侧隐藏的菜单从左边划出来. 做完之后在手机原生浏览器中运行正常,但在QQ和微信中打开,发现touchmove只会触发一次,而且to ...
- dragloader.js帮助你在页面原生滚动下实现Pull Request操作
dragloader.js是一个面向移动Web开发的JavaScript库,帮助开发者在使用页面原生滚动时,模拟上/下拉手势,实现Pull Request操作. 在移动设备上,一般会使用 drag d ...
- 浅谈jQuery页面的滚动位置scrollTop、scrollLeft
Web页面常常比显示该页面的浏览器窗口还要大,因为Web文档具有很多内容,往往会导致页面比浏览器还要高,有时候甚至还要宽,这迫使访问者通过滚动来查看整个页面(如图10-8所示).当访问者滚动页面的时候 ...
- jQuery.smoove — jQuery和CSS3炫酷滚动页面内容元素动画特效插件
插件介绍: jQuery-smoove是一款jQuery和CSS3炫酷滚动页面内容元素动画特效插件.该内容元素动画插件在页面滚动到指定位置时,该位置的HTML元素会执行指定的CSS3动画特效,如旋转. ...
- 解决TabActivity中子页面不通过导航跳转到还有一个页面的问题
问题:当你的导航在TabActivity中 而子页面的一个button须要切换到当中的某一个导航页面 转载请注明出处:http://blog.csdn.net/x605940745 demo下载地址: ...
随机推荐
- 【转】Python 中的 if __name__ == '__main__' 该如何理解
转自:http://blog.konghy.cn/2017/04/24/python-entry-program/ 程序入口 对于很多编程语言来说,程序都必须要有一个入口,比如 C,C++,以及完全面 ...
- python print的用法
第一种是格式化的 strHello = "the length of (%s) is %d" %('Hello World',len('Hello World')) import ...
- 常见web安全攻防总结
Web 安全的对于 Web 从业人员来说是一个非常重要的课题 , 所以在这里总结一下 Web 相关的安全攻防知识,希望以后不要再踩雷,也希望对看到这篇文章的同学有所帮助.今天这边文章主要的内容就是分析 ...
- 在AD中存取照片
AD中有存放照片的字段吗? 答案肯定是有的.photo,jpegPhoto,thumbnailPhoto 前端时间客户,包括领导 在问通讯录中的照片为什么存在数据库中而不是AD中,AD中的属性能不能利 ...
- Jqmobile Secha Ionic比较
1. Jqmobile 轻量级框架,它的语言基于 jquery 语言容易上手,运行速度快,但是没有 MVC 多人协作 开发的概念,项目比较大后 代码不易维护 (中小项目 1-2 个人开发很适 ...
- Spring JUnit org.hibernate.HibernateException: Unable to get the default Bean Validation factory
org.hibernate.HibernateException: Unable to get the default Bean Validation factory <property nam ...
- 微信小程序设置底部导航栏目方法
微信小程序底部想要有一个漂亮的导航栏目,不知道怎么制作,于是百度找到了本篇文章,分享给大家. 好了 小程序的头部标题 设置好了,我们来说说底部导航栏是如何实现的. 我们先来看个效果图 这里,我们添加了 ...
- Linux Namespace
转载请注明出处,并保留以上所有对文章内容.图片.表格的来源的描述. 一.Linux Namespace Linux Namespace是Linux提供的一种OS-level virtualizatio ...
- java HttpClient 获取页面Cookie信息
HttpClient client = new HttpClient(); GetMethod get=new GetMethod("http://www.baidu.com"); ...
- LLMNR欺骗工具Responder
LLMNR(Link-Local Multicast Name Resolution,链路本地多播名称解析)协议是一种基于DNS包格式的协议.它可以将主机名解析为IPv4和IPv6的IP地址.这样用户 ...