新浪微博,和QQ空间里面,都有那个下拉刷新的效果,另很多人眼前一亮,细细分析,原理原来如此。...下面,就亮出关键代码,自定义的一个MyListView: /** * 重写一个ListView,主要是添加一个下拉事件 * * @author way * */...inflater; private LinearLayout headView;// ListView头部的View private TextView tipsTextview;// 提示信息“下拉刷新... Log.v(TAG, "由松开刷新状态转变到done状态"); } // 往下拉了...Log.v(TAG, "当前状态,下拉刷新"); break; case REFRESHING:// 正在刷新状态 headView.setPadding
Google官方的下拉刷新组建 activity代码实现: /** * The SwipeRefreshLayout should be used whenever the user * can..., android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light....widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id=..."@+id/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent...android:text="@string/hello_world" /> android.support.v4.widget.SwipeRefreshLayout
下拉刷新 + 加载更多? 本类库是单纯的下拉刷新。...支持各种下拉刷新交互. 下拉刷新(iOS风格) ? 释放刷新(经典风格) ? 刷新时,头部保持(新浪微博) ?...Studio, 稳定版 compile 'in.srain.cube:ultra-ptr:1.0.11' 配置 有6个参数可配置: 阻尼系数 默认: 1.7f,越大,感觉下拉时越吃力。...下拉刷新 / 释放刷新 默认为释放刷新 xml中配置示例 <in.srain.cube.views.ptr.PtrFrameLayout android:id="@+id/store_house_ptr_frame...检查是否可以下拉刷新在PtrDefaultHandler.checkContentCanBePulledDown中有默认简单的实现,你可以根据实际情况完成这个逻辑。
(其实是iOS的同学在是现功能的时候秀了一波操作) 效果大概是这样子的: 下拉放大 UI看完后 “这个效果不错啊” “要不你们Android也么做?”...重置部分 在onTouchEvent的ACTION_UP中重置Header,实现回弹 对事件分发不了解的,这边有两篇不错的文章 Android事件分发机制 详解攻略,您值得拥有 图解 Android...试试效果 使用 直接在需要下拉放大的布局外面套上FlexibleLayout即可,例如ScrollView <com.gavin.view.flexible.FlexibleLayout android...:layout_width="match_parent" android:layout_height="match_parent"> <ScrollView ... >...当然里面还有一些细节的处理,比如下拉的条件、回弹的动画、最大高度等,具体内容的可以在源码中看到。 完善 完成下拉放大后,貌似把一个很重要的功能遗忘了下拉刷新 ?? 光顾这下拉放大,刷新怎么办?
100 ; i ++) { list.add( "ddd") ; } return list ; } } 刷新模式 //向下拉...-- ptrHeaderSubTextColor 刷新提示子选项颜色值 --> 运行结果 分别设置 下拉 和 上拉 显示的字体 //得到下拉时候显示的...= pullToRefreshListView.getLoadingLayoutProxy( true , false ) ; startLayout.setPullLabel("你可劲拉,拉...下拉...");// 刚下拉时,显示的提示 startLayout.setRefreshingLabel("好嘞,正在刷新...下拉");// 刷新时 startLayout.setReleaseLabel...-- ptrRotateDrawableWhilePulling 当动画设置为rotate时,下拉是是否旋转。 --> <!
> android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com.../tools" android:id="@+id/activity_main" android:layout_width="match_parent" android:layout_height..."> <Spinner android:id="@+id/spinner1" android:layout_width="0dp" android...import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.util.Log;...import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView
android下拉五级菜单联动 一、问题引出 本人是一个不擅长Android的开发的,但是这几天在做联通的一个服务器配件管理系统,做完B/S的又要写C/S的,老板要求没办法。...在做的过程中遇到了一个下拉菜单联动的问题,以前没做过,突然做还真有点不知所措了,在网上找了一大堆发现数据都是本地的应该构造好了,没卵用,不过也给了我很多想发,一开始想到用树去解决,可是每个树的节点个数不知道...客户端代码 public class Main2Activity extends AppCompatActivity { //下拉组件 private Spinner factorySpinner...下拉xml文件 下拉菜单联动请在博客里寻找。
应用禁用通知栏下拉这个需求让我头疼了好几天 statusbar用了后但是效果不是很满意 其他的方法试过但是没有效果,所以就换个思路吧 做法是在通知栏区域弄一个透明的window,这样下拉的时候触摸的区域就是这个...window,系统的就下拉不了了 该做法是需要在应用上方显示一个window 所以需要权限 android:name="android.permission.SYSTEM_ALERT_WINDOW...status_bar_height"; public static final String DIMEN = "dimen"; public static final String DEF_PACKAGE = "android
概要 试了很多第三方的下拉刷新不是效果不好看 就是有bug,最后还是决定用官方的下拉刷新,但是官方的默认不支持进入页面立即刷新,所以我们可以用官方的并对其扩展 官方原版的用法 XML android.support.v4....widget.SwipeRefreshLayout android:id="@+id/id_swipe_ly" android:layout_width="match_parent"...android:layout_height="match_parent"> <ListView android:id="@+id/file_list" android...SwipeRefreshLayout.OnRefreshListener接口 添加回调方法 @Override public void onRefresh() { loadData(); } 初始化 //下拉刷新...android:layout_height="match_parent" android:divider="@color/zj_qianhuise" android:dividerHeight
本实例的自定义下拉菜单主要是继承PopupWindow类来实现的弹出窗体,各种布局效果可以根据自己定义设计。...弹出的动画效果主要用到了translate、alpha、scale,具体实现步骤如下: 先上效果图如下:左边下拉菜单、中间下拉菜单、右边下拉菜单 ? ? ?...android:id="@+id/left_tv" android:layout_width="0dp" android:layout_height="wrap_content" android...android:ellipsize="end" android:gravity="center_horizontal" android:maxLength="4" android:..." android:gravity="center_horizontal" android:maxLength="4" android:singleLine="true" android
> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http:...//schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent..." android:layout_height="wrap_content" android:entries="@array/sex" android:prompt...android:id="@+id/spinner_personal" android:layout_width="match_parent" android...="30sp"/> 最后就是下拉选项的引用了 在values里建一个自定义xml就行 这里是/values/chooseArrays <?
(1)在我刚学android的时候,用的是XListView,在github上搜索有 MarkMjw/PullToRefresh ,根据Maxwin的XListView改造而来,完善下拉刷新上拉加载更多的功能并实现自动刷新以及自动加载等功能...(6)同时,这里也要提下 liaohuqiu/android-Ultra-Pull-To-Refresh ,已经强大到什么控件都能适用刷新了,相信你也听过了 (7)看过最有创意的下拉刷新FlyRefresh...(15) bingoogolapple/BGARefreshLayout-Android 多种下拉刷新效果、上拉加载更多、可配置自定义头部广告位… (16) BeautifulRefreshLayoutForGirl..., 下拉刷新拥有侵入式,非侵入式,覆盖式,非覆盖式,自动刷新,上拉加载更多,自动加载等功能…… (19) WaveRefreshForAndroid 这个是基于 Android-PullToRefresh...温馨提示:如需RecyclerView加载更多,请参考: https://github.com/android-cjj/Android-RecyclerViewWithFooter 如果有好的下拉刷新的可以和我一块交流
ExpandableListView是android中可以实现下拉list的一个控件,具体的实现方法如下: 首先:在layout的xml文件中定义一个ExpandableListView android:id="@+id/linearLayout" android:layout_width="fill_parent" android:layout_height="fill_parent..." androidrientation="vertical" > <ExpandableListView android:id="@+id/expandableListView"...android:layout_width="fill_parent" android:layout_height="wrap_content" /> 定义两个...源码下载:http://files.cnblogs.com/salam/WidgetDemo.rar ExpandableListView是Android中的手风琴,本人感觉效果相当棒。
在极客学院的Android学习中,发现其下拉刷新组件用的是比较老的组件,现在Google官方出的是SwipeRefreshLayout,借此机会学习了一下。...先附上图: image.png xml资源文件 android.support.v4.widget.SwipeRefreshLayout android:id="@+id/swipeLayout..." android:layout_width="match_parent" android:layout_height="match_parent"> android:layout_width="match_parent" android:layout_height="wrap_content" android:id="...SwipeRefreshLayout*/ swipeLayout = (SwipeRefreshLayout) findViewById(R.id.swipeLayout); /*设置下拉刷新监听器
4、在布局文件xml的Spinner下添加: android:entries="@array/spinnerclass" ? 5、运行app,即可自动加载列表进去 ?...R.array.spinnerclass); 3、建立Adapter并且绑定数据源 ArrayAdapter adapter=new ArrayAdapter(this,android.R.layout.simple_spinner_item..., mItems); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); 4、绑定 Adapter...> parent) { // Another interface callback } }); 其他如下拉样式等内容,请自行另外搜索~~
简介 SwipeRefreshLayout是Google官方推出的一款下拉刷新组件,位于v4兼容包下,android.support.v4.widget.SwipeRefreshLayout,Support...Color.GREEN, Color.YELLOW, Color.RED); // 设置手指在屏幕下拉多少距离会触发下拉刷新...mSwipeLayout.setDistanceToTriggerSync(300); // 设定下拉圆圈的背景 mSwipeLayout.setProgressBackgroundColorSchemeColor...Color.WHITE); // 设置圆圈的大小 mSwipeLayout.setSize(SwipeRefreshLayout.LARGE); //设置下拉刷新的监听...mListView.setAdapter(mAdapter); } /* * 监听器SwipeRefreshLayout.OnRefreshListener中的方法,当下拉刷新后触发
---恢复内容开始--- 一、前段代码 <Spinner android:id="@+id/spin" android:paddingTop="10px" android:layout_width...="fill_parent" android:layout_height="50sp"/> <Button android:id="@+id/addList" android:...layout_width="wrap_content" android:layout_height="wrap_content" android:text="添加" /> 二、接下来新建一个下拉列表的视图资源...> android="http://schemas.android.com/apk/res/android" android:id="@+id/tv1"...(2)textViewResourcId TextView的资源id (3) 最后一个参数是你要向下拉列表中添加的数据,可以是一个静态的String数组,也可以是一个动态的List;
原因 所谓的下拉消失效果就是抽屉功能。...Google有提供一个抽屉功能的Dialog叫做:BottomSheetDialog 这个库其实就在 implementation 'com.google.android.material:material
最近项目中用到了ListView的下拉刷新的功能,总结了一下前辈们的代码,单独抽取出来写了一个demo作为示例。...效果图 下拉刷新: 加载更多: CustomListView.java package com.example.uitest.view; import java.util.Date; import...; /** * ListView下拉刷新 * */ public class CustomListView extends ListView implements OnScrollListener...= DONE; changeHeaderViewByState(); } // 往下拉了...在下拉刷新完成之后要调用 mListView.onRefreshComplete(); 来隐藏掉 头部,调用 mListView.onLoadComplete(); 隐藏掉 底部的加载view。
实现效果: 这个效果就是仿qq个人中心的下拉弹回效果实现。...; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Rect...; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import...> android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com...android:layout_marginTop="-100dp" android:contentDescription="@null" android
领取专属 10元无门槛券
手把手带您无忧上云