Android仿京东搜索框渐变效果
作者:AND_Devil 时间:2022-09-08 19:57:05
在许多APP中,有的搜索框是一直固定的,有的呢,附加了很多的效果,就比如京东
好吧,谁让京东那么厉害呢,不说了,开始 * !
原理:就是自定义scrollview实现对滑动高度的监听而已,如此实现对搜索框的渐变
先贴上我的自定义scrollview
//自定义ScrollView
public class CustomView extends ScrollView {
public interface ScrollViewListener {
void onScrollChanged(CustomView customView, int x, int y, int oldx, int oldy);
}
private ScrollViewListener scrollViewListener = null;
public CustomView(Context context) {
super(context);
}
public CustomView(Context context, AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
}
public CustomView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setScrollViewListener(ScrollViewListener scrollViewListener) {
this.scrollViewListener = scrollViewListener;
}
@Override
protected void onScrollChanged(int x, int y, int oldx, int oldy) {
super.onScrollChanged(x, y, oldx, oldy);
if (scrollViewListener != null) {
scrollViewListener.onScrollChanged(this, x, y, oldx, oldy);
}
}
}
来源:https://blog.csdn.net/qq_40543575/article/details/79666499
标签:Android,京东,搜索框
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
使用OkHttp包在Android中进行HTTP头处理的教程
2023-06-16 23:55:37
Java实现最小生成树算法详解
2023-11-25 04:51:22
![](https://img.aspxhome.com/file/2023/8/59678_0s.png)
SpringBoot之通过BeanPostProcessor动态注入ID生成器案例详解
2023-11-24 22:17:26
![](https://img.aspxhome.com/file/2023/1/59251_0s.jpg)
C#针对xml基本操作及保存配置文件应用实例
2022-11-24 05:51:17
Spring MVC注解式开发使用详解
2021-07-08 23:27:50
![](https://img.aspxhome.com/file/2023/2/129232_0s.jpg)
基于Java手写一个好用的FTP操作工具类
2021-06-05 20:10:18
![](https://img.aspxhome.com/file/2023/0/98410_0s.jpg)
Java的关键字与标识符小结
2023-08-17 08:36:50
![](https://img.aspxhome.com/file/2023/2/72602_0s.png)
android利用ContentResolver访问者获取手机短信信息
2022-02-02 15:02:37
![](https://img.aspxhome.com/file/2023/1/116051_0s.jpg)
Opencv实现读取摄像头和视频数据
2023-07-16 15:19:58
深入浅析Mybatis的缺陷问题
2023-07-19 19:39:46
java json 省市级联实例代码
2021-11-13 18:50:35
带你了解mybatis如何实现读写分离
2023-07-29 14:26:28
Java 8中的18个常用日期处理(收藏)
2023-03-02 02:01:54
![](https://img.aspxhome.com/file/2023/1/66491_0s.jpg)
一文带你弄懂Java中线程池的原理
2023-09-10 20:59:02
![](https://img.aspxhome.com/file/2023/5/90025_0s.png)
c#打包文件解压缩的实例
2022-07-22 11:20:20
![](https://img.aspxhome.com/file/2023/2/89792_0s.jpg)
Java多线程run方法中直接调用service业务类应注意的问题及解决
2021-12-28 19:51:46
![](https://img.aspxhome.com/file/2023/0/92680_0s.png)
Spring-Security实现登录接口流程
2023-03-24 05:35:40
![](https://img.aspxhome.com/file/2023/4/70334_0s.png)
C#快速实现IList非泛型类接口的自定义类作为数据源
2022-10-09 20:28:24
![](https://img.aspxhome.com/file/2023/1/98221_0s.jpg)
c#实现KTV点歌系统
2023-10-17 23:54:56
![](https://img.aspxhome.com/file/2023/9/100199_0s.png)
java开发中遇到的异常汇总详解
2023-03-21 02:54:15