- 浏览: 447778 次
- 性别:
- 来自: 成都
文章分类
- 全部博客 (133)
- 内容 (5)
- H2数据库 Server服务器 (0)
- H2数据库 Server服务器 H2+JPA (2)
- JSF (10)
- TA测试 (1)
- Error Solution (1)
- WEB端测试 (2)
- JAVA API (0)
- WEB端自动化测试 (14)
- BAT文件 (1)
- javascript (0)
- Jenkins (5)
- Nexus (1)
- 操作系统 (3)
- OFBIZ (2)
- spingmvc (1)
- Hibernate3 (4)
- ubuntu (1)
- apache (2)
- Cisco (0)
- JBoss (2)
- SecureCRT (1)
- mysql (0)
- android (45)
- PHP (4)
- android studio (4)
- nodejs (1)
- iOS (0)
- JPA (1)
- gradle (0)
- Android端自动化测试 (2)
- okhttp3 (1)
- Java (2)
- mybatis (1)
- kettle (0)
最新评论
-
紫瑶诗书:
Android自动化测试实战(Java篇+主流工具+框架+脚本 ...
使用Robotium进行android自动化测试 -
wxynxyo:
上善若水_Happy 写道你好,想请教下icon的css是怎么 ...
Primefaces3之p:tree -
上善若水_Happy:
你好,想请教下icon的css是怎么写的?
Primefaces3之p:tree -
weijs:
谢谢,这个文章解决了我的疑问
Jenkins 部署项目到远端的TOMCAT下 -
ljl961890233bear:
<bean id="st ...
springmvc 发送ajax中文乱码的几种解决办法
使用ViewPage+ListView做出如下图的效果:
设计思路如下:
1. 一个总的fragment作为父,三个选项分别也是fragment, 父类布局:
2. 父类里面自定义了adapter,继承了FragmentStatePagerAdapter
3. 父类代码
4. 用于展示的三个子fragment使用LISTVIEW就可以, 配合适配器或自己定义的适配器
注意:如果在每一个item里面还嵌套的有listview的话, 如针对某一个ITEM的多条回复
这个时候ITEM的焦点会被listview获取,有可能出现点item无响应的情况,需要在根目录下加:
设计思路如下:
1. 一个总的fragment作为父,三个选项分别也是fragment, 父类布局:
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/common_title_bg" android:orientation="horizontal"> <LinearLayout android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="4" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:layout_marginLeft="15dp" android:layout_marginRight="15dp" android:orientation="horizontal" android:background="@drawable/bg_city_search_selector"> <ImageView android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginLeft="15dp" android:src="@drawable/common_search_icon" /> <EditText android:id="@+id/main_hall_search_txt" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="4" android:textSize="15sp" android:maxLength="15" android:singleLine="true" style="@style/common_edit_hint_drawable_style" android:paddingTop="10dp" android:paddingBottom="10dp" android:inputType="textNoSuggestions" android:hint="输入开发商名称" /> <ImageView android:id="@+id/main_hall_search_delete_img" android:layout_width="wrap_content" android:layout_height="match_parent" style="@style/right_icon_class" android:clickable="true" android:src="@drawable/input_right_delete_icon"/> </LinearLayout> <RelativeLayout android:id="@+id/main_hall_cancel_lyt" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:clickable="true" android:gravity="center"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/top_text_big" android:text="@string/common_cancel"/> </RelativeLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="@dimen/main_hall_title_height" android:background="@color/xwhite" android:orientation="horizontal"> <RelativeLayout android:id="@+id/main_hall_search_lyt_0" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:clickable="true" android:gravity="center"> <TextView android:id="@+id/main_hall_txt_0" android:layout_width="match_parent" android:layout_height="match_parent" style="@style/main_hall_search_title" android:text="综合"/> <ImageView android:id="@+id/main_hall_img_0" android:layout_width="match_parent" android:layout_height="wrap_content" style="@style/main_hall_select_style" /> </RelativeLayout> <View android:layout_width="1dp" android:layout_height="match_parent" style="@style/middle_separate_horizontal_style_10"/> <RelativeLayout android:id="@+id/main_hall_search_lyt_1" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:clickable="true"> <TextView android:id="@+id/main_hall_txt_1" android:layout_width="match_parent" android:layout_height="match_parent" style="@style/main_hall_search_title" android:text="好评"/> <ImageView android:id="@+id/main_hall_img_1" android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="invisible" style="@style/main_hall_select_style" /> </RelativeLayout> <View android:layout_width="1dp" android:layout_height="match_parent" style="@style/middle_separate_horizontal_style_10"/> <RelativeLayout android:id="@+id/main_hall_search_lyt_2" android:layout_width="0dp" android:layout_height="match_parent" android:layout_weight="1" android:clickable="true"> <TextView android:id="@+id/main_hall_txt_2" android:layout_width="match_parent" android:layout_height="match_parent" style="@style/main_hall_search_title" android:text="砍价次数"/> <ImageView android:id="@+id/main_hall_img_2" android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="invisible" style="@style/main_hall_select_style" /> </RelativeLayout> </LinearLayout> <View android:layout_width="match_parent" android:layout_height="1dp" style="@style/middle_separate"/> <android.support.v4.view.ViewPager android:id="@+id/main_hall_search_viewpage" android:layout_width="fill_parent" android:layout_height="fill_parent" />
2. 父类里面自定义了adapter,继承了FragmentStatePagerAdapter
public class LocalFragmentAdapter<T> extends FragmentStatePagerAdapter { private List<T> list; private Activity activity; public LocalFragmentAdapter(Fragment fm, List<T> list, Activity activity) { super(fm.getFragmentManager()); this.list = list; this.activity = activity; } @Override public int getCount() { return list.size(); } @Override public Fragment getItem(int i) { return (Fragment)list.get(i); } //用于刷新数据使用, 获取的查询字段放入缓存变量里面 public void setSearchAndPosition(int currentPageIndex, Editable searchWord) { //用于刷新数据 Fragment fragment = getItem(currentPageIndex); if (!TextUtils.isEmpty(searchWord)) { User.myself.mainHallSearchWord = searchWord.toString(); } else { User.myself.mainHallSearchWord = null; } fragment.onResume(); super.notifyDataSetChanged(); } }
3. 父类代码
//页面滚动 main_hall_search_viewpage.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageScrolled(int i, float v, int i1) { } @Override public void onPageSelected(int position) { changeSelect(position); fragmentAdapter.setSearchAndPosition(currentPageIndex, main_hall_search_txt.getText()); } @Override public void onPageScrollStateChanged(int i) { } }); //搜索字段 main_hall_search_txt.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) { } @Override public void afterTextChanged(Editable editable) { fragmentAdapter.setSearchAndPosition(currentPageIndex, editable); } });
4. 用于展示的三个子fragment使用LISTVIEW就可以, 配合适配器或自己定义的适配器
注意:如果在每一个item里面还嵌套的有listview的话, 如针对某一个ITEM的多条回复
这个时候ITEM的焦点会被listview获取,有可能出现点item无响应的情况,需要在根目录下加:
android:descendantFocusability="blocksDescendants"
发表评论
-
如何自己做一个Launcher App
2017-05-18 09:27 0自定义一个自己的Launcher App,并在这个App上控制 ... -
android CPU架构和对应的libs
2017-05-16 17:47 991官网内容: 有如上的几种架构方式,不同的手机使用不 ... -
如何屏蔽HOME,MENU键
2017-05-12 13:40 1179如何屏蔽HOME,MENU键,找了很多答案,下面就是几种办法 ... -
EditText光标随着输入移动
2017-04-26 09:35 1826当前需求如下:点击一个按钮,弹出自定义的键盘,同时输入框内 ... -
调用DialogFragment出现的Can not perform this action after onSaveInstanceState
2017-04-24 09:13 2023代码里面用如下的业务场景:进页面并判断是否签到,没有签到就跳转 ... -
使用自定义的Launcher.apk替代系统的
2017-04-23 08:54 10731.首先使用adb shell命令 ... -
Android避免重复提交的问题
2017-04-06 12:08 752关于某些控件,多次点击导致的重复提交问题,我汇总如下: 1. ... -
使用Retrofit2.0+spingmvc上传图片和参数
2017-03-03 08:58 973如题,使用SPINGMVC接收数据 服务端接口如下 ... -
百度定位 WIFI正常 电信3G出错;Error Code:62
2016-12-22 09:29 1120使用一款4.3系统的手机,在开发过程中发现如下的问题 1.W ... -
关于CPU ABI的一些零碎
2016-08-17 15:18 703首先是一篇文章 关于SO文件你应该知道的 http://ph0 ... -
防止Activity被销毁以后fragment依然存在的问题
2016-08-11 15:49 0App被切换到后台以后,当前的Activity的生命周期 ... -
使用PullToRefreshListView下拉和加载代码
2016-08-05 10:55 1318//三个参数 private int pageNo = ... -
Android连接服务端出现中文乱码的问题
2016-08-01 15:46 609这个是常见问题,我给出我的排查和解决办法。 前提条件 ... -
TextInputLayout的使用
2016-06-14 14:39 1064使用AS发现模板下的 ... -
Android项目代码Inspect Code的各种问题以及集合
2016-05-31 10:22 0一个android项目,使用inspect code,居 ... -
使用Apollo And Mosquitto 作为MQTT Server
2016-05-13 09:56 9017始于环信的消息推送,了解了下目前的几种推送模式,XMP ... -
环信项目分析之2
2016-05-10 14:56 883第二篇主要介绍一下服务端如何与环信进行交互, 环信的官网 ... -
Jersy之路1
2016-05-09 22:00 599关于Jersey2.X 就不巴拉巴拉说这么多废话了。 ... -
环信项目分析之1
2016-05-09 21:32 789系列文章主要是用于分析环信的APP,消息推送等功能。 基 ... -
Okhttp3 学习历程之一
2016-04-27 10:43 1731最近想把一个简单的安卓APP重写一下,写的过程中就涉及到 ...
相关推荐
`ViewPager` 主要用于创建滑动页面的效果,而 `ListView` 则是展示可滚动的列表内容。当 `ViewPager` 需要与 `ListView` 结合使用时,可以构建出更复杂的布局,比如在一个页面中滑动查看多个列表内容。下面将详细...
在Android应用开发中,我们经常会遇到复杂布局的嵌套,比如`SlidingMenu`、`ViewPager`和`ListView`的组合。这样的设计可以为用户提供类似网易新闻客户端的体验,左侧是滑动菜单,中间是`ViewPager`用于切换不同的...
`ListView`则是一种可以展示大量列表数据的视图,通常用于显示具有滚动效果的数据集合。结合适配器(如`BaseAdapter`或`ArrayAdapter`),`ListView`可以根据数据源动态生成并显示列表项。 在处理图片加载时,尤其...
在这个`Frament+ViewPage+listViewDemo`中,我们将深入探讨如何利用这些组件实现一个滑动点击进入第二个`Activity`的效果。 首先,`Fragment`是Android中的一个模块化组件,它允许开发者将UI部分拆分为多个片段,每...
其余界面都简单,唯独是淘歌界面有点复杂, ViewPager中嵌套ViewPager+ListView,ListView中还嵌套GridView。由于要整屏滑动,所以在ViewPager+ListView外部嵌套个SrcollView,出现问题了ListView和SrcollView滑动 ...
标题"viewpage嵌套listview,效果:滑动listview删除,滑动非listview区域viewpage翻页"描述的就是这样一个功能:在ViewPager中嵌套了一个ListView,ListView支持滑动删除,而当滑动到ListView之外的区域时,...
新闻首页效果[仿网易](ViewPager+Fragment+ListView), 1.添加fragment对象到fragment列表 2.添加title到title列表 3.从title列表中取出内容放到tabLayout容器中 4.创建并初始化适配器 5.为viewPager设定适配器 6....
在Android开发中,ListView、ViewPager、Fragment以及TabHost是构建复杂用户界面的四个核心组件,它们结合使用可以创建出丰富的滑动效果和交互体验。现在我们来深入探讨这些知识点。 首先,ListView是Android中用于...
在Android开发中,`ViewPage`和`ListView`是两种常用的UI组件。`ViewPager`主要用于实现页面滑动的效果,常用于展示多个相似内容的页面,如应用的标签页。而`ListView`则是一个可以滚动显示多行数据的列表视图,适合...
在Android开发中,`ScrollView`、`ViewPager`和`ListView`或`RecyclerView`是常见的UI组件,它们分别用于实现不同的滚动视图效果。本篇将深入探讨如何将这些组件组合使用,尤其是涉及到“加载更多”功能的实现。 ...
在Android开发中,实现类似QQ滑动界面的效果通常涉及到`ViewPager`组件的使用,它可以创建一个可以左右滑动切换的页面容器。在这个场景下,我们不仅要实现`ViewPager`的滑动,还要在每个`ViewPager`的页面中嵌入`...
本文将深入探讨如何实现一个平滑的侧滑效果,并解决`ViewPage`与`ListView`滑动冲突的问题。 首先,我们要了解`ViewPage`的基本工作原理。`ViewPage`内部包含一个`PagerAdapter`,它管理着一系列的页面(通常是`...
`ViewPager`通常用于实现水平滑动的页面切换效果,而`ListView`则用于展示垂直方向上的列表项。本文将详细介绍如何在`ViewPager`中嵌套`ListView`进行轮播。 首先,理解`ViewPager`的基本用法。`ViewPager`是...
在Android开发中,"下拉刷新ListView+ViewPage"是一个常见的功能组合,它结合了ListView的下拉刷新机制和ViewPager的图片无限自动切换效果。这个主题涵盖了多个关键知识点,包括ListView、ViewPager的基本使用,以及...
ViewPage是一种滑动页面的效果,常用于实现应用内部的水平滚动视图,如在浏览多个页面时进行左右切换。ListView则是一个可滚动的视图,通常用来显示大量的列表数据。 抽屉效果通常通过`SlidingMenu`库来实现,它...
Android listview viewpager 滑动 跳动 冲突解决 ListView中嵌套ViewPage有或者滑动手势冲突解决 blog 地址 : http://blog.csdn.net/aaawqqq/article/details/43824631
当我们需要在一个列表项中嵌入多个页面视图时,将ListView与ViewPager结合使用就能达到同时滑动的效果。这个技术点通常出现在如电商应用的商品详情页,每个商品图片可以左右滑动查看,而整个商品列表则上下滚动。 ...
在"仿网易新闻 viewpage"的设计中,我们看到两个关键功能的融合:一是ViewPager的页面切换,二是ListView的数据滚动。为了实现描述中的功能,开发者需要自定义适配器和交互逻辑。具体来说,可能涉及以下技术点: 1....
可以通过监听ListView的滚动状态并在适当时机禁止ViewPager的滑动,或者使用第三方库如`androidx.swiperefreshlayout.widget.SwipeRefreshLayout`来封装整个布局,以实现更流畅的滑动效果。 总结起来,"listview...