Android点击事件之后跳到界面指定位置
16lz
2021-12-04
首先在布局文件外部添加一个滚动试题,目的是为了跳到指定位置之后还可以向上滚动
ScrollView
android:layout_width="280px"
android:layout_height="wrap_content"
android:id="@+id/reading_choices_scroll"
LinearLayout
android:id="@+id/reading_choices"
android:layout_width="280px"
android:layout_height="wrap_content"
android:orientation="vertical"
/
/ScrollView
主要在点击事件的处理
//得到滚动控件
reading_choices_scroll = (ScrollView)findViewById(R.id.reading_choices_scroll);
//设置滚动控件跳到的位置,第一个为X轴,第二个为Y轴调动之后的坐标,此处我垂直跳到
reading_choices_scroll.scrollTo(0,212);
ScrollView
android:layout_width="280px"
android:layout_height="wrap_content"
android:id="@+id/reading_choices_scroll"
LinearLayout
android:id="@+id/reading_choices"
android:layout_width="280px"
android:layout_height="wrap_content"
android:orientation="vertical"
/
/ScrollView
主要在点击事件的处理
//得到滚动控件
reading_choices_scroll = (ScrollView)findViewById(R.id.reading_choices_scroll);
//设置滚动控件跳到的位置,第一个为X轴,第二个为Y轴调动之后的坐标,此处我垂直跳到
reading_choices_scroll.scrollTo(0,212);
更多相关文章
- Android(安卓)Theme详细
- Android(安卓)Studio菜鸟开发————LinearLayout线性布局
- android xml布局文件属性说明
- Android下图片或按钮等可拖动到任意位置的效果实现源码
- Android界面布局开发使用的标签介绍
- Android中MaterialDesign使用 (四)CoordinatorLayout初识:AppBar
- Android控件之EditText(输入文本框控件)
- Android(安卓)布局
- Android(安卓)自定义View之手势解锁控件