- 浏览: 142746 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (172)
- java (172)
- c# winform 关于窗体最大化时的是否全屏效果与是否遮盖任务栏 (1)
- c# winform 只运行一个程序实例 (1)
- Shiro权限框架 (1)
- Java字节码(.class文件)的代码解析 (1)
- Hibernate、Spring和Struts工作原理及使用理由 (1)
- 基本PKG处理命令 (1)
- 最近写的代码的小结 (1)
- Dual Palindromes (1)
- 编译TortoiseSVN1.7源代码笔记 (1)
- Android项目代码混淆 (1)
- 关于就业叨咕几句 (1)
- Java重定向System.out和System.err (1)
- IHS与WAS集成插件静默安装 (1)
- 专题地图概述 (1)
- 关于MapXtreme2004附带Sample不能运行的问题 (1)
- SQL注入漏洞 (1)
- 回顾过去 展望未来(写给自己) (1)
- DB2认证考试经验谈(700&&701) (1)
- 今天用到了RM格式文件的分割工具RealProducer (1)
- 搜索引擎还是很有发展前途的 (1)
- 泰利德破解,实现学校机房免费上网 (1)
- Arduino 引言:移动互联外设传感展望 (1)
- c/c++ static 用法总结(三版本合一) (1)
- JQuery与xml的组合谈 (1)
- Android开发之消息处理机制(一)——Handler (1)
- Android开发之PopupWindow (1)
- 解析BitmapData.getPixel32()返回值因何不准确 (1)
- 关于Ext引用js的顺序问题 (1)
- Js事件大全 (1)
- 使用JavaFX2.0编写国际象棋游戏 (1)
- Hibernate/JPA常见异常分析与解决 (1)
最新评论
-
amcucn:
这排版看得
Shiro权限框架 -
WAMING5:
这也太紧凑了,眼看花了
Shiro权限框架 -
longzhun:
大虾 ,看得出你很懒啊!发个贴 这样子怎么看!!!
Shiro权限框架 -
swanky_yao:
活干的不细!!
Spring+Hibernate框架下Mysql读写分离、主从数据库配 -
饶首建:
不错,不过用处比较少吧
批处理设ip和dns
先看效果:
main.xml:
slipentity.java
slipview.java
iaiaiactivity.java
下面是用到的三张图片:
main.xml:
<?xml version="1.0" encoding="utf-8"?><linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <textview android:id="@+id/textview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="ddd" /> <com.diydyq.android.swipetest.slipview android:id="@+id/slipview" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> </com.diydyq.android.swipetest.slipview></linearlayout>
slipentity.java
package com.iaiai.activity;import java.util.hashmap;import java.util.map;import android.graphics.bitmap;import android.util.log;/** * * <p> * title: slipentity.java * </p> * <p> * e-mail: 176291935@qq.com * </p> * <p> * qq: 176291935 * </p> * <p> * http: iaiai.iteye.com * </p> * <p> * create time: 2011-8-11 * </p> * * @author 丸子 * @version 0.0.1 */public class slipentity { public static final int flag_back = 1; public static final int flag_frot = 2; public static final float dock_l = 0; public static final float dock_m = (float) 0.5; public static final float dock_r = 1; public static final float micro_x = 10; /** background image */ bitmap backimage; /** front image */ bitmap frotimage; /** start position of back image */ float xbackstart; /** start position of back image */ float ybackstart; /** start position of front image */ float xfrotstart; /** start position of front image */ float yfrotstart; /** initial position of front image */ float xfrotinitpos; /** initial position of front image */ float yfrotinitpos; /** margin of front and back image in x-axis */ float xmarginleft; /** margin of front and back image in y-axis */ float ymargintop; /** containing dock position of the front image */ map<float, float> dockposlist = new hashmap<float, float>(); /** current dock percentage: dock_l | dock_m | dock_r */ float curdockper = dock_l; /** weather has invoked initslipentity() */ boolean isinit = false; public slipentity() { } public slipentity(bitmap backimage, bitmap frotimage) { this.backimage = backimage; this.frotimage = frotimage; } public slipentity(float xbackstart, float ybackstart, float xfrotstart, float yfrotstart) { this.xbackstart = xbackstart; this.ybackstart = ybackstart; this.xfrotstart = xfrotstart; this.yfrotstart = yfrotstart; } public void initslipentity(float viewwidth, float viewheight) { this.xbackstart = (viewwidth - this.backimage.getwidth()) / 2; this.ybackstart = (viewheight - this.backimage.getheight()) / 2; this.xmarginleft = 5; this.ymargintop = (this.backimage.getheight() - this.frotimage .getheight()) / 2; this.xfrotinitpos = this.xbackstart + this.xmarginleft; this.yfrotinitpos = this.ybackstart + this.ymargintop; this.xfrotstart = this.xfrotinitpos; this.yfrotstart = this.yfrotinitpos; // add dock position float dockl = this.xfrotinitpos; float dockr = this.xbackstart + this.backimage.getwidth() - this.frotimage.getwidth() - this.xmarginleft; this.dockposlist.put(dock_l, dockl); this.dockposlist.put(dock_r, dockr); for (float dockper : this.dockposlist.keyset()) { if (this.dockposlist.get(dockper) == 0) { float docpos = (dockr - dockl) * dockper + this.dockposlist.get(dock_l); this.dockposlist.put(dockper, docpos); } } // dock at current position this.xfrotstart = this.dockposlist.get(this.curdockper); this.isinit = true; // for debug information stringbuilder sb = new stringbuilder(); sb.append("backimagew:" + this.backimage.getwidth() + "\n"); sb.append("backimageh:" + this.backimage.getheight() + "\n"); sb.append("frotimagew:" + this.frotimage.getwidth() + "\n"); sb.append("frotimageh:" + this.frotimage.getheight() + "\n"); sb.append("xbackstart:" + xbackstart + "\n"); sb.append("ybackstart:" + ybackstart + "\n"); sb.append("xmarginleft:" + xmarginleft + "\n"); sb.append("ymargintop:" + ymargintop + "\n"); sb.append("xfrotinitp:" + xfrotinitpos + "\n"); sb.append("yfrotinitp:" + yfrotinitpos + "\n"); sb.append("xfrotstart:" + xfrotstart + "\n"); sb.append("yfrotstart:" + yfrotstart + "\n"); log.v("slipentity", sb.tostring()); } /** * weather the front image reaches the max right of background image, if * true, set xfrotstart to max right. * * @return */ public boolean isreachright() { if (this.xfrotstart > this.dockposlist.get(dock_r)) { this.curdockper = dock_r; this.xfrotstart = this.dockposlist.get(dock_r); return true; } else { return false; } } /** * weather the front image reaches the max left of background image, if * true, set xfrotstart to max left. * * @return */ public boolean isreachleft() { if (this.xfrotstart < this.dockposlist.get(dock_l)) { this.curdockper = dock_l; this.xfrotstart = this.dockposlist.get(dock_l); return true; } else { return false; } } /** * weather the point(x,y) is in the area of back or front image * * @param type * flag_frot(front image) | flag_back(back image) * @param x * x-coordinate of point * @param y * y-coordinate of point * @return weather the point is in specified area */ public boolean ispointinimage(int type, float x, float y) { float rpointx; float rpointy; switch (type) { case flag_frot: rpointx = this.xfrotstart + this.frotimage.getwidth(); rpointy = this.yfrotstart + this.frotimage.getheight(); if (x > this.xfrotstart && y > this.yfrotstart && x < rpointx && y < rpointy) return true; else return false; case flag_back: rpointx = this.xbackstart + this.backimage.getwidth(); rpointy = this.ybackstart + this.backimage.getheight(); if (x > this.xbackstart && y > this.ybackstart && x < rpointx && y < rpointy) return true; else return false; default: return false; } } /** * is the current touch in some dock position * * @return return dockper if in, or -1 while no match */ public float isdock() { for (float dockper : this.dockposlist.keyset()) { float dockpos = this.dockposlist.get(dockper); if (this.xfrotstart > dockpos - micro_x && this.xfrotstart < dockpos + micro_x) { this.curdockper = dockper; return dockper; } } return -1; } /** * get the current dock percentage in x-axis * * @return */ public float getcurdockper() { return this.curdockper; } /** * get the current dock position in x-axis * * @return */ public float getcurdockpos() { return this.dockposlist.get(this.curdockper); } /** * add dock position to the list * * @param dockper * dock percent should be between (0.0,1.0) */ public void adddockpos(float dockper) { if (dockper > 0 && dockper < 1) { this.dockposlist.put(dockper, (float) 0.0); } } /** * return width of background image * * @return */ public float getbackwidth() { return this.backimage.getwidth(); } /** * return height of background image * * @return */ public float getbackheight() { return this.backimage.getheight(); } /** * return width of front image * * @return */ public float getfrotwidth() { return this.frotimage.getwidth(); } /** * return height of front image * * @return */ public float getfrotheight() { return this.frotimage.getwidth(); } /** * dock at some position * * @param curdockper */ public void setcurdockpos(float curdockper) { this.curdockper = curdockper; } public bitmap getbackimage() { return backimage; } public void setbackimage(bitmap backimage) { this.backimage = backimage; } public bitmap getfrotimage() { return frotimage; } public void setfrotimage(bitmap frotimage) { this.frotimage = frotimage; } public float getxbackstart() { return xbackstart; } public void setxbackstart(float xbackstart) { this.xbackstart = xbackstart; } public float getybackstart() { return ybackstart; } public void setybackstart(float ybackstart) { this.ybackstart = ybackstart; } public float getxfrotstart() { return xfrotstart; } public void setxfrotstart(float xfrotstart) { this.xfrotstart = xfrotstart; } public float getyfrotstart() { return yfrotstart; } public void setyfrotstart(float yfrotstart) { this.yfrotstart = yfrotstart; } public float getxfrotinitpos() { return xfrotinitpos; } public void setxfrotinitpos(float xfrotinitpos) { this.xfrotinitpos = xfrotinitpos; } public float getyfrotinitpos() { return yfrotinitpos; } public void setyfrotinitpos(float yfrotinitpos) { this.yfrotinitpos = yfrotinitpos; } public float getxmarginleft() { return xmarginleft; } public void setxmarginleft(float xmarginleft) { this.xmarginleft = xmarginleft; } public float getymargintop() { return ymargintop; } public void setymargintop(float ymargintop) { this.ymargintop = ymargintop; } public map<float, float> getdockposlist() { return dockposlist; } public void setdockposlist(map<float, float> dockposlist) { this.dockposlist = dockposlist; } public boolean isinit() { return isinit; } public void setinit(boolean isinit) { this.isinit = isinit; }}
slipview.java
package com.iaiai.activity;import android.content.context;import android.graphics.bitmap;import android.graphics.canvas;import android.graphics.drawable.bitmapdrawable;import android.util.attributeset;import android.util.log;import android.view.motionevent;import android.view.view;/** * * <p> * title: slipview.java * </p> * <p> * e-mail: 176291935@qq.com * </p> * <p> * qq: 176291935 * </p> * <p> * http: iaiai.iteye.com * </p> * <p> * create time: 2011-8-11 * </p> * * @author 丸子 * @version 0.0.1 */public class slipview extends view { private static final string tag = "slipview"; /** listen slip on the block, no matter the event is success or fail */ private onsliplistener onsliplistener; /** slip entity to set the value about backimage, frontimage position */ private slipentity slipentity; private float tmptouchx; private float tmptouchgap; public slipview(context context) { super(context); bitmap backimage = ((bitmapdrawable) getresources().getdrawable( r.drawable.back5)).getbitmap(); bitmap frotimage = ((bitmapdrawable) getresources().getdrawable( r.drawable.frot1)).getbitmap(); this.slipentity = new slipentity(backimage, frotimage); } public slipview(context context, attributeset attr) { super(context, attr); bitmap backimage = ((bitmapdrawable) getresources().getdrawable( r.drawable.back5)).getbitmap(); bitmap frotimage = ((bitmapdrawable) getresources().getdrawable( r.drawable.frot1)).getbitmap(); this.slipentity = new slipentity(backimage, frotimage); } public slipview(context context, slipentity slipentity) { super(context); this.slipentity = slipentity; } @override protected void ondraw(canvas canvas) { super.ondraw(canvas); if (!this.slipentity.isinit) { log.v(tag, "init slipentity"); this.slipentity.initslipentity(this.getwidth(), this.getheight()); } canvas.drawbitmap(this.slipentity.getbackimage(), this.slipentity.xbackstart, this.slipentity.ybackstart, null); canvas.drawbitmap(this.slipentity.getfrotimage(), this.slipentity.xfrotstart, this.slipentity.yfrotstart, null); } /** * listen touch events and notify listener */ @override public boolean ontouchevent(motionevent event) { log.v(tag, "touch position:" + event.getx()); switch (event.getaction()) { case motionevent.action_down: // log.v(tag, "down"); if (this.slipentity.ispointinimage(slipentity.flag_frot, event.getx(), event.gety())) { this.tmptouchx = event.getx(); this.tmptouchgap = event.getx() - this.slipentity.xfrotstart; } break; case motionevent.action_move: // log.v(tag, "move"); this.slipentity.isreachright(); this.slipentity.isreachleft(); // if point(x,y) is not in back image, front image will not move if (this.slipentity.ispointinimage(slipentity.flag_back, event.getx(), event.gety())) { // log.v(tag, "move2"); this.slipentity.xfrotstart = event.getx() - this.tmptouchgap; } break; case motionevent.action_up: log.v(tag, "up"); int flaglr = 0; if (event.getx() < this.tmptouchx) flaglr = 1; else flaglr = 2; float dockper = this.slipentity.isdock(); if (dockper != -1) { // dock at some position if (this.onsliplistener != null) this.onsliplistener.slipdock(slipentity, event, this.slipentity.getcurdockper()); if (event.getx() < this.tmptouchx) { // slip: <== if (dockper == 0.0) { // reached if (this.onsliplistener != null) this.onsliplistener.slipleft(slipentity, event, true); } else { // not reached this.slipentity.xfrotstart = this.slipentity .getcurdockpos(); if (this.onsliplistener != null) this.onsliplistener.slipleft(slipentity, event, false); } } else { // slip: ==> if (dockper == 1.0) { // reached if (this.onsliplistener != null) this.onsliplistener.slipright(slipentity, event, true); } else { // not reached this.slipentity.xfrotstart = this.slipentity .getcurdockpos(); if (this.onsliplistener != null) this.onsliplistener.slipright(slipentity, event, false); } break; } } else { // no dock this.slipentity.xfrotstart = this.slipentity.getcurdockpos(); if (flaglr == 1) this.onsliplistener.slipleft(slipentity, event, false); else this.onsliplistener.slipright(slipentity, event, false); } // if (event.getx() < this.tmptouchx) // { // // slip: <== // if (this.slipentity.isreachleft()) // { // // reached // if (this.onsliplistener != null) // this.onsliplistener.slipleft(slipentity, event, true); // } // else // { // // not reached // this.slipentity.xfrotstart = this.slipentity.getcurdockpos(); // if (this.onsliplistener != null) // this.onsliplistener.slipleft(slipentity, event, false); // } // } // else // { // // slip: ==> // if (this.slipentity.isreachright()) // { // // reached // if (this.onsliplistener != null) // this.onsliplistener.slipright(slipentity, event, true); // } // else // { // // not reached // this.slipentity.xfrotstart = this.slipentity.getcurdockpos(); // if (this.onsliplistener != null) // this.onsliplistener.slipright(slipentity, event, false); // } // break; // } } this.invalidate(); return true; } /** * listener on slip event on slippery view author diydyq * */ public interface onsliplistener { /** * listen a slip after touch down and up, not including touch move * * @param slipentity * @param event * @param issuccess */ public abstract void slipleft(slipentity slipentity, motionevent event, boolean issuccess); /** * listen a slip after touch down and up, not including touch move * * @param slipentity * @param event * @param issuccess */ public abstract void slipright(slipentity slipentity, motionevent event, boolean issuccess); /** * listen some dock(more than dock_l,dock_r), normally need not * implement it unless more docks are needed. * * @param slipentity * @param event * @param dockper */ public abstract void slipdock(slipentity slipentity, motionevent event, float dockper); } public onsliplistener getonsliplistener() { return onsliplistener; } public void setonsliplistener(onsliplistener onsliplistener) { this.onsliplistener = onsliplistener; }}
iaiaiactivity.java
package com.iaiai.activity;import android.app.activity;import android.graphics.bitmap;import android.graphics.drawable.bitmapdrawable;import android.os.bundle;import android.util.log;import android.view.motionevent;import com.iaiai.activity.slipview.onsliplistener;/** * * <p> * title: iaiaiactivity.java * </p> * <p> * e-mail: 176291935@qq.com * </p> * <p> * qq: 176291935 * </p> * <p> * http: iaiai.iteye.com * </p> * <p> * create time: 2011-8-11 * </p> * * @author 丸子 * @version 0.0.1 */public class iaiaiactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // setcontentview(r.layout.main); slipview view; // 1.code bitmap backimage = ((bitmapdrawable) getresources().getdrawable( r.drawable.back5)).getbitmap(); bitmap frotimage = ((bitmapdrawable) getresources().getdrawable( r.drawable.frot1)).getbitmap(); slipentity entity = new slipentity(backimage, frotimage); entity.setcurdockpos(slipentity.dock_r); entity.adddockpos((float) 0.5); view = new slipview(this, entity); // 2.code // view = new slipview(this); // 3.xml // view = (slipview)this.findviewbyid(r.id.slipview); setcontentview(view); view.setonsliplistener(new onsliplistener() { @override public void slipleft(slipentity slipentity, motionevent event, boolean issuccess) { log.v("left", boolean.tostring(issuccess)); } @override public void slipright(slipentity slipentity, motionevent event, boolean issuccess) { log.v("right", boolean.tostring(issuccess)); } @override public void slipdock(slipentity slipentity, motionevent event, float dockper) { log.v("dock", "dockper:" + dockper); } }); }}
下面是用到的三张图片:
发表评论
-
Hibernate/JPA常见异常分析与解决
2012-02-07 17:24 15141. ClassNotFoundException: ... -
使用JavaFX2.0编写国际象棋游戏
2012-02-07 16:24 1093前面发布了不少Javafx2的教程,不觉手痒,想尝试一 ... -
Js事件大全
2012-02-04 15:34 788一般事件 事件 ... -
关于Ext引用js的顺序问题
2012-02-02 15:49 768今天自己搞了个ext的helloworld,所需的包都 ... -
解析BitmapData.getPixel32()返回值因何不准确
2012-02-02 12:29 1004<div style="widt ... -
Android开发之PopupWindow
2012-01-31 13:48 1684<h1>Android开发之PopupWi ... -
Android开发之消息处理机制(一)——Handler
2012-01-11 15:19 1171<h1>Android开发之消息处理机制( ... -
JQuery与xml的组合谈
2011-12-21 17:18 804JQuery与xml的组合谈 今天谈的是XML,学ja ... -
c/c++ static 用法总结(三版本合一)
2011-12-21 10:34 819<span style="&qu ... -
Arduino 引言:移动互联外设传感展望
2011-12-20 14:08 1328作者:mznewfacer (Wolf Geek) ... -
泰利德破解,实现学校机房免费上网
2011-12-20 13:58 950泰利德破解,实现学校机房免费上网<br> ... -
搜索引擎还是很有发展前途的
2011-12-19 11:49 969相信大家已经听说,在头几天,搜狐推出了一个专业搜索门户 ... -
今天用到了RM格式文件的分割工具RealProducer
2011-12-19 09:19 713项目要加一些视频文件,这些视频都是几个老师对数据结构课 ... -
DB2认证考试经验谈(700&&701)
2011-12-16 17:17 1119很多人都通过了D ... -
回顾过去 展望未来(写给自己)
2011-12-15 16:19 1501本来想用“昨天今天明天”做标题来着,但是人家本山大叔说 ... -
SQL注入漏洞
2011-12-15 12:19 722CSDN上的ASP.NET电子杂志下载下来看,就看到了 ... -
关于MapXtreme2004附带Sample不能运行的问题
2011-12-15 10:54 689</span> -
专题地图概述
2011-12-14 12:49 854<p class="MsoNorma ... -
IHS与WAS集成插件静默安装
2011-12-14 12:04 968<span style="col ... -
Java重定向System.out和System.err
2011-12-13 14:49 1179<div>继承PrintStream类: ...
相关推荐
如果选项数量较少,可以简单地将它们作为子View添加到我们的滑动控件中;如果选项很多,使用`RecyclerView`会更合适,它可以高效地复用视图并动态加载数据。 四、滑动动画 为了让滑动效果更加流畅,我们可以使用...
1. `SlideWidget.java` - 这是自定义滑动控件的核心类,它会包含滑动逻辑的实现。 2. `res/layout/slide_widget.xml` - 这是布局文件,定义了控件的外观和结构,可能包含子View的排列和触摸监听器的设置。 3. `...
在Android开发中,自定义滑动接听电话控件组是一种常见的功能实现,它为用户提供了一种直观、便捷的接听电话方式。这样的控件通常由一个显示来电信息的界面和一个可滑动的接听/挂断按钮组成。在这个场景中,我们将...
在自定义滑动控件中,我们可以通过设置Scroller的滚动距离和速度,来实现平滑的滑动效果。通常,在ACTION_UP事件中启动Scroller,然后在`computeScroll()`方法中检查Scroller是否还在滚动,并更新视图的位置。 ...
【仿酷狗左右滑动控件】是一种在Android开发中常见的交互设计,它借鉴了酷狗音乐应用中的滑动切换效果,通常用于实现如歌曲列表、播放器界面等场景的左右切换。这种控件能够提供流畅且直观的用户体验,使得用户可以...
总的来说,ReboundScrollView是一个结合了物理动画和弹性滑动的Android自定义控件,它在标准ScrollView的基础上增加了横向弹性滑动功能,并优化了滑动体验,避免了已知的bug。开发者可以通过学习和使用这个控件,...
在创建自定义滑动控件时,我们通常会重写以下方法: 1. **onMeasure()**: 这个方法用于测量所有子视图的大小,并确定ViewGroup自身的大小。我们需要根据自己的需求来计算合适的宽高。 2. **onLayout()**: 在这个...
本文将深入探讨如何创建一个名为`UIScrollLayout`的自定义组合控件,它支持界面的流畅滑动以及左右菜单的滑动功能。这个控件可以通过设置`view_type`参数来切换不同的显示模式,从而为用户提供两种不同的视图体验。 ...
在Android开发中,有时我们需要创建具有独特交互效果的控件,比如滑动选择器,而`WheelView`就是这样一种自定义的控件。它通常用于日期选择、时间选择或者选项滚动等场景,提供了类似滚轮的视觉效果和操作体验。在你...
左右滑动评分,不限于做评分。一分,反正评论后会返分。
本项目名为"Android item可左右滑动的listview控件",是几年前的一个Android应用源码Demo,非常适合学生作为毕业设计学习。 在传统的ListView中,用户只能通过点击来交互,而这个Demo引入了侧滑功能,使得用户可以...
看到这种问题,自然而然的就会想到scrollview和其他可滑动控件的冲突问题。 解决思路 用户的左右滑动操作被最外层的scrollView控件处理掉了,所以只要让scrollview对左右滑动事件不监听,让其子控件处理左右滑动事件...
标题"Android 自定义可上下左右滑动table"指向的就是一个专门为Android平台设计的定制化表格控件,它不仅支持垂直滚动(上下滑动),还支持水平滚动(左右滑动),这在处理大数据量或需要展示宽幅信息时非常有用。...
在Android应用开发中,滑动选择控件是常见的交互元素,用于实现用户通过滚动来选取特定值或选项。本资源提供了名为"WheelView"的自定义控件,它支持双级联动,即两个轮盘之间存在关联性,当一个轮盘的值改变时,另一...
Android 仿抖音上下滑动布局详解 Android 仿抖音上下滑动布局是指在 Android 应用程序中实现类似抖音 App 的上下滑动布局效果,该效果可以实现上下滑动、监听播放、自动吸顶、吸底等功能。本文将详细介绍 Android ...
通过研究这些内容,开发者不仅可以学习到如何创建滑动温度表盘控件,还能了解到Android自定义控件的完整流程,包括设计思路、代码实现、UI优化和文档编写等方面的知识。 总结来说,这个自定义控件是Android开发中的...
滑动切换屏幕的控件通常用于模仿手机或平板设备的主屏幕效果,用户可以通过左右滑动来浏览不同的屏幕页面。这种效果可以应用于各种场景,如应用启动页、多视图展示或者信息浏览等。在Android中,我们可以利用...
通过以上步骤,我们就成功实现了Android ScrollView向上滑动时控件顶部悬浮的效果。这种效果不仅提高了用户的操作便利性,也使界面设计更加美观和统一。在实际开发中,还可以根据项目需求进行适当的调整和优化,比如...
这个"Android-类似 iOS 带弹簧效果的左右滑动控件"就是一个专为此目的设计的库,它可以被集成到AbsListView(如ListView)或RecyclerView中,为item提供动态、真实的物理反馈效果。 该控件的核心功能是模拟iOS的...
ViewPager是Android SDK中的一个非常实用的控件,常用于实现水平滑动的页面浏览。它可以承载多个Fragment或View,并通过手势左右滑动进行切换。要使用ViewPager,首先需要在布局文件中添加它,然后在代码中设置...