adapter

Autocomplete items disappearing

◇◆丶佛笑我妖孽 提交于 2019-12-06 13:31:54
I have a strange problem regarding suggestion items for an AutocompleteView on Android 2.2. I am using a custom ArrayAdapter and Filter class implementation. When I type into the AutocompleteView the suggestion drop-down pops up after entering two characters as shown in the following screenshot: When I enter a third character the drop-down disappears: After entering a fourth character the suggestion drop-down is displayed again: I don't understand why the drop-down disappears when an uneven amount of characters is entered. While debugging I noticed that getView() is called twice when an even

Android: Expandable Navigation Drawer with custom row views

↘锁芯ラ 提交于 2019-12-06 13:21:00
I'm trying to do a navigation drawer menu with expandable elements like this --> http://goo.gl/SkMU8N I had no idea so I started by doing something like this one (not mine). https://github.com/PrashamTrivedi/DrawerLayoutTest The problem is that those rows are simple text and they looks horrible. I want to know how to modify the Adapter (or whatever) to attach my own xml files like you do with the normal drawer (example here --> http://goo.gl/phAJy ). Thanks a lot!! Here an example of slide list item https://github.com/tjerkw/Android-SlideExpandableListView What I've done --> http://goo.gl

案例分析:设计模式与代码的结构特性

左心房为你撑大大i 提交于 2019-12-06 13:12:34
我选择分析的设计模式是“ 适配器模式(Adapter Pattern) ” 应用的场景是:1.业务的接口与工作的类不兼容,(比如:类中缺少实现接口的某些方法)但又需要两者一起工作;2. 在现有接口和类的基础上为新的业务需求提供接口。 一、简单介绍 适配器模式(Adapter Pattern)就是把一个类的接口变换成客户端所期待的另一种接口,从而使原本因接口原因不匹配而无法一起工作的两个类能够一起工作。适配类可以根据参数返还一个合适的实例给客户端。 二、适配器模式的结构 适配器模式分为类适配器模式和对象适配器模式。关于类适配模式,因为java的单继承,所以在已继承一个类时,另外的只能是接口,需要手动实现相应的方法,这样在客户端就可以创建任一种符合需求的子类,来实现具体功能。而另外一种对象适配器,它不是使用继承再实现的方式,而是使用直接关联,或者称为委托的方式。我们生活中常常听到的是: 电源适配器,它是用于电流变换(整流)的设备。适配器的存在,就是为了将已存在的东西(接口)转换成适合我们的需要、能被我们所利用。在现实生活中,适配器更多的是作为一个中间层来实现这种转换作用。在上面的通用类图中,Cient 类最终面对的是 Target 接口(或抽象类),它只能够使用符合这一目标标准的子类;而 Adaptee 类则是被适配的对象(也称 源角色),因为它包含specific (特殊的)操作

ListView is very laggy - Android

时光毁灭记忆、已成空白 提交于 2019-12-06 12:01:09
I've created a custom ListView. I've tried to optimize the getView method of my ListView's Adapter but I'm still experiencing lag. What am I doing wrong in the Adapter that causes my ListView to lag? Or if it looks good, what could be causing the lag? The xml of a row in the ListView is: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="6dip" android:background="@color/all_white" android:orientation="vertical"> <LinearLayout android:layout

How to change the name of a NetworkAdapter in c#?

亡梦爱人 提交于 2019-12-06 10:53:03
问题 People claim the following VB script works for changing network adapter names. However I am having a decidedly difficult time trying to convert this to a c# appliaction that can do the same thing. The problem I seem to be facing is that calls to the NetworkInterface.Name is readonly. Option Explicit Const NETWORK_CONNECTIONS = &H31& Dim sOldName= WScript.Arguments(0) Dim sNewName= WScript.Arguments(1) Dim objShell, objFolder, colItems, objItem Set objShell = CreateObject("Shell.Application")

Kotlin实战案例:带你实现RecyclerView分页查询功能(仿照主流电商APP,可切换列表和网格效果)

落花浮王杯 提交于 2019-12-06 10:32:26
随着Kotlin的推广,一些国内公司的安卓项目开发,已经从Java完全切成Kotlin了。虽然Kotlin在各类编程语言中的排名比较靠后(据TIOBE发布了 19 年 8 月份的编程语言排行榜,Kotlin竟然排名45位),但是作为安卓开发者,掌握该语言,却已是大势所趋了。 Kotlin的基础用法,整体还是比较简单的,网上已经有很多文章了,大家熟悉下即可。 案例需求 此次案例,之所以选择分页列表,主要是因为该功能通用性强,涵盖的技术点也较多,对开发者熟悉Kotlin帮助性较大。 案例的主要需求如下( 参考主流电商APP实现 ): 1、列表支持手势滑动分页查询(滑动到底部时,自动查询下一页,直到没有更多数据) 2、可切换列表样式和网格样式 3、切换样式后,数据位置保持不变(如当前在第100条位置,切换样式后,位置不变) 4、footview根据查询状态,显示不同内容: a、数据加载中... (正在查询数据时显示) b、没有更多数据了 (查询成功,但是已没有可返回的数据了) c、出错了,点击重试!!(查询时出现异常,可能是网络,也可能是其他原因) 5、当查询出错时,再次点击footview,可重新发起请求(例如:网络异常了) 6、当切换网格样式时,footview应独占一行 设计 虽然是简单案例,咱们开发时,也应先进行简单的设计,让各模块、各类都各司其职、逻辑解耦

Listview, custom adapter and checkboxes

℡╲_俬逩灬. 提交于 2019-12-06 10:24:45
i got an issue with my adapter. Here is the code: @Override public View getView(final int position, final View convertView, final ViewGroup parent) { final ViewHolder viewHolder; View view = convertView; if (view == null) { view = LayoutInflater.from(mContext).inflate(R.layout.row, parent, false); viewHolder = new ViewHolder(); viewHolder.textTitle = (TextView) view.findViewById(R.id.title); viewHolder.checkBox = (CheckBox) view.findViewById(R.id.checkBox); viewHolder.checkBox.setTag(position); view.setTag(viewHolder); viewHolder.imageView = (ImageView) view.findViewById(R.id.activity

Adapter pattern for IDbSet properties of a DbContext class

[亡魂溺海] 提交于 2019-12-06 10:20:56
Is there a way to use the method described in this answer No FindAsync() method on IDbSet for DbSet properties of a DbContext? Edit: The answer linked contains a description how to build a interface inheriting from IDbSet and adding support for the SearchAsync method of the DbSet class. I understand everything which Keith Payne has written, but I don’t know how I can use it in DbContext. For example I’ve a DbContext which looks something like this: public class MyContext : DbContext { public DbSet<Customer> Customers { get; set; } } How can I use MyDbSet (class described in the answer.) or a

Facing issue in Position value during Drag and drop in RecyclerView android

别等时光非礼了梦想. 提交于 2019-12-06 10:03:25
问题 How do i get new position value during drag and drop in RecyclerView adapter? Drag and Drop is working perfect but when i set setOnClickListener to open my detail activity. it gives me the old position value. For example : If i drag 2nd item (INDEX 1) and drop at 1st item's position (INDEX 0). On debuging inside setOnClickListener when i am calling Intent. Position value is 1 (INDEX 1) but what i need is value 0 (INDEX 0). @Override public void onBindViewHolder(final ItemViewHolder holder,

Calling notifyDataSetChanged from inside adapter fails

谁说胖子不能爱 提交于 2019-12-06 08:55:44
问题 I have an adapter (extends BaseAdapter) from which I'm trying to call notifyDataSetChanged(), but it's not working. I believe notifyDataSetChanged() is actually being called, based on stepping into it using the Eclipse debugger. However, it doesn't call getView(). The data underlying my adapter is being changed, as it should. I have a method, updateSettings(), in the adapter that updates the data underlying the adapter. If I call updateSettings() from my ListViewActivity, I don't have any