recyclerview

NullPointerException - Attempt to invoke virtual method RecyclerView$ViewHolder.shouldIgnore()' 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

Recyclerview scrollToPosition doesn't work with NestedScrollView ? Is there anyway?

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So I have a Recyclerview within a NestedScrollView . When I say recycleview.scrollToPosition(X) or recycleview.getLayoutManager().scrollToPosition(X) it doesn't work at all. If I move the recycleview out from the nestedScrollView it works fine, but I can't do it, because of the layout structure! Any idea? scrollingView.requestChildFocus(recyclerView,recyclerView); tried this, but not focusing on a certain position 回答1: make your recyclerview like this <LinearLayout android:id="@+id/ll2" android:focusableInTouchMode="true" android:layout

Add a ListView or RecyclerView to new NavigationView

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am using the new NavigationView from revision 22.2.0 of the support library by Google. It works perfectly fine to generate a navigation drawer populated using a menu res. I was wondering is it possible to add a ListView or RecyclerView to the navigation drawer so that it can be populated using my custom adapter code, which allows for far greater flexibility than menu resources. Here is my current XML: Where in my XML would I add the ListView or RecyclerView? EDIT As per Basant's suggestion, I nested a ListView into the

Cause for NullPointerException android.support.v7.widget.RecyclerView.onMeasure

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am getting following Exception 01-27 11:15:15.756 18348-18348/com.example.pnimje.newswipelistview E/AndroidRuntime: FATAL EXCEPTION: main java.lang.NullPointerException at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:1764) at android.view.View.measure(View.java:15848) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:728) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:477) at android.view.View.measure(View.java:15848) at android.view.ViewGroup.measureChildWithMargins(ViewGroup

Display a RecyclerView in Fragment

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying out the new RecyclerView in Android Lollipop and I'm stuck. I'm trying to receive a list, with an icon and a TextView to the right of the icon, inside a Fragment . I found this great tutorial on how to set up a RecyclerView . I have followed every point and only changed the item_layout.xml to fit my needs. The project builds without any errors but when it launches on my device I'm getting this error: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.fredrikaldgard.materialcolors/com.fredrikaldgard

Passing MotionEvents from RecyclerView.OnItemTouchListener to GestureDetectorCompat

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a Fragment that implemets RecyclerView.OnItemTouchListener. How do I pass click and long-click motion events only from the RecyclerView to the GestureDetectorCompat. That is I mean I only want to handle clicks and long-clicks, rest of the events should be handled by the RecyclerView as it would happen normally. How can I set this up? public class MyFragment extends Fragment implements RecyclerView.OnItemTouchListener, GestureDetector.OnGestureListener { protected RecyclerView recyclerView; protected RecyclerView.Adapter adapter;

Background Selector in RecyclerView Item

匿名 (未验证) 提交于 2019-12-03 01:17:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using the RecyclerView like below: and my list item: see in detail this part android:background="@drawable/selector_medium_high" it's a normal selector: but when I run this code, i have no changes in background color when I touch the row.... 回答1: Set clickable , focusable , focusableInTouchMode to true in all elements of RecyclerView "list". 回答2: Add : android:background="?android:attr/selectableItemBackground" in item.xml 回答3: Adding android:background="?android:attr/selectableItemBackground" to my_list_item.xml 's root layout seems to

How to make RecyclerView scroll smoothly?

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: This is more like a generic question, but after lot of search and try I am not able to understand why this is so difficult to achieve. This is the closest answer I can find but still unable to implement. To be specific I am using RecyclerView with GridLayoutManager. All I want is the grid layout to scroll smoothly (like default gallary app) ,nothing fancy, but the default implementation of grid layout manager scrolls the view in a 'jerky' manner. I tried to implement the method from above link but unsuccessfully. I also tried to

Android: RecyclerView: No adapter attached; skipping layout

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I keep getting the error "RecyclerView: No adapter attached; skipping layout" when the RecyclerView list is shown. I have 3 tabs and one tab has a RecyclerView list that is populated from SQLite database. I don't get any crashes and the data is shown correctly in the view but I still get this error. I thought it was just a warning because the data is in place correctly but when I tried onClick it doesn't work and I'm sure it has something to do with this error. I know this question has been asked a lot before but I checked most of the

RxJava,Retrofit Error :Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2 path $

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Retrofit and RxJava Library and trying to parse this url: My code is as below. APIInterface.java public interface APIService { @GET("/bins/tdze5") Observable<List<Student>> getdata(); } MainActivity.java public class MainActivity extends AppCompatActivity { private RecyclerView recyclerView; private List<Student> list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); recyclerView = (RecyclerView) findViewById(R.id.recyclerview); getData(); }