viewholder

Parent click event not firing when recyclerview clicked

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a RecyclerView which is in a CardView that has a couple of TextViews. The CardView has a OnClickListener set and is fired off when clicking on the TextViews, but does not fire when clicking on the RecyclerView. Here is what the CardView looks like: <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:card_view="http://schemas.android.com/apk/res-auto" android:id="@+id/card_view" android:layout_width="match_parent" android:layout_height="match_parent

Android RecyclerView

不羁岁月 提交于 2019-12-03 02:24:18
简介: RecyclerView是support-v7包中的新组件,是一个强大的滑动组件,与经典的ListView相比,同样拥有item回收复用的功能,但是直接把viewholder的实现封装起来,用户只要实现自己的viewholder就可以了,该组件会自动帮你回收复用每一个item。 它不但变得更精简,也变得更加容易使用,而且更容易组合设计出自己需要的滑动布局。 要使用RecyclerView,其实你也可以只下载一个jar包,添加到自己的libs里就能使用它了 使用它的理由: RecyclerView is a more advanced and flexible version of ListView . This widget is a container for large sets of views that can be recycled and scrolled very efficiently. Use the RecyclerView widget when you have lists with elements that change dynamically. 简单说,它是ListView的进化,为了当你需要动态展示一组数据的时候就会需要它。 当然,如果只是动态展示数据,listview也可以做到,用它替代listview的原因有几个:

RecyclerView.getChild(index) shows null when list is scrolled (index gets messed up)

匿名 (未验证) 提交于 2019-12-03 02:18:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been using SwipeableRecyclerView for my android application for enabling swipes for my recyclerView. RecyclerView contains a list of cardViews. I was trying to implement undo functionality for cards which will get deleted when swipe to left (first swipe shows undo, next swipe triggers delete) I am trying the following code (partially working I guess) SwipeableRecyclerViewTouchListener srvTouchListner = new SwipeableRecyclerViewTouchListener(rvTimerList, new SwipeableRecyclerViewTouchListener.SwipeListener(){ @Override public boolean

Need an example about RecyclerView.Adapter.notifyItemChanged(int position, Object payload)

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: First, sorry about my English. According to RecyclerView documentation about medthod notifyItemChanged(int position, Object payload) Notify any registered observers that the item at position has changed with an optional payload object. I don't understand how to use second paramenter payload in this method. I have searched many document about "payload" but everything was ambiguous. So, If you know about this method, please show me a clear example about it. Thank you very much. 回答1: Check out this sample code that demonstrates the feature. It

Unconditional layout, inflation from view adapter: Should use View Holder pattern

匿名 (未验证) 提交于 2019-12-03 02:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am getting following warning in eclipse: Unconditional layout inflation from view adapter: Should use View Holder pattern (use recycled view passed into this method as the second parameter) for smoother scrolling. on: convertView = vi.inflate(R.layout.activity_friend_list_row, parent, false); I have a base adapter with a checkbox implemented and I have added a tag to make the check box work. Here is the code: public View getView(final int position, View convertView, ViewGroup parent) { ViewHolder mViewHolder; mViewHolder = new ViewHolder()

Android listing BLE devices after device scan

匿名 (未验证) 提交于 2019-12-03 01:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Can u provide me the simple code for scanning the nearby BLE devices and list it by device name and MAC ID. I tried this using sample code provided in http://developer.android.com/guide/topics/connectivity/bluetooth-le.html . But didn't work, any reference link or ideas since i am new to BLE app. 回答1: This example is based on the developers web you posted and works great for me. This is the code: DeviceScanActivity.class package com . example . android . bluetoothlegatt ; import android . app . Activity ; import android . app .

itemview may not be null error in RecyclerViewAdapter

匿名 (未验证) 提交于 2019-12-03 01:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to add multiple views in a recyclerview. So first I added getItemView method, @Override public int getItemViewType(int position) { return type.get(position); } Then in the oncreateviewholder method I added this @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v = null; switch (viewType){ case 0: v = LayoutInflater.from (parent.getContext ()).inflate (R.layout.view1, parent, false); case 1: v = LayoutInflater.from (parent.getContext ()).inflate (R.layout.view2, parent, false);; case

Nested Recycler view height doesn&#039;t wrap its content

匿名 (未验证) 提交于 2019-12-03 01:27:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an application that manage collections of books (like playlists). I want to display a list of collection with a vertical RecyclerView and inside each row, a list of book in an horizontal RecyclerView. When i set the layout_height of the inner horizontal RecyclerView to 300dp, it is displayed correctly but when i set it to wrap_content, it doesn't display anything. I need to use wrap_content because I want to be able to change the layout manager programmatically to switch between vertical and horizontal display. Do you know what i'm

NullPointerException - Attempt to invoke virtual method RecyclerView$ViewHolder.shouldIgnore()&#039; on a null object reference

匿名 (未验证) 提交于 2019-12-03 01:25:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Several developers have reported seeing the following stack trace since upgrading to Android Support 23.2.0: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.support.v7.widget.RecyclerView$ViewHolder.shouldIgnore()' on a null object reference at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2913) at android.support.v7.widget.RecyclerView.consumePendingUpdateOperations(RecyclerView.java:1445) at android.support.v7.widget.RecyclerView.access$400(RecyclerView.java:144) at android

StandardGSYVideoPlayer视频播放

匿名 (未验证) 提交于 2019-12-03 00:30:01
< com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer android :id= "@+id/detail_player" android :layout_width= "match_parent" android :layout_height= "250dp" /> //加载视频 videoUrl = dataBean .getVideoUrl(); viewHolder . detail_player .setUpLazy( videoUrl , true , null , null , "哈哈哈" ); //全屏动画 viewHolder . detail_player .setShowFullAnimation( true ); //设置返回键 viewHolder . detail_player .getBackButton().setVisibility(View. GONE ); //设置全屏按键功能 viewHolder . detail_player .getFullscreenButton().setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { viewHolder . detail