recyclerview-layout

RecyclerView reverse endless scrolling

走远了吗. 提交于 2019-12-07 02:20:05
问题 I'm creating a chat app and I am trying to implement endless scrolling for RecyclerView in a reversed manner, like start from the bottom and scroll up, when top is reached, load more. When the user opens the chat screen, the app gets the last 20 messages and scrolls to the bottom by default. I want to get more messages from the server as the user scrolls up. The following is just a generic endless scrolling code i am testing with: protected void onCreate(Bundle savedInstanceState) { super

Switch between RecyclerView layouts when click on AlertDialog item list

落爺英雄遲暮 提交于 2019-12-06 06:33:04
问题 I have three different layouts cardsListLayout , titleLayout , cardMagazineLayout and there may be more in the future, which used as a views on onCreateViewHolder method. I want to switch between views in onCreateViewHolder method so when user choose from AlertDialog list this onOptionsItemSelected in MainActivity Where there is menu Item "change the layout" so that when the user presses it it appears AlertDialog list @Override public boolean onOptionsItemSelected(MenuItem item) { if (item

How to scroll the RecyclerView programatically by a specific pixels?

天涯浪子 提交于 2019-12-05 17:33:48
I had extended recyclerview so i can scale it. It works the way I wanted it but now I wanted to programmatically scroll by x amount of pixels. The user story for this is that, if I tap on the upper half part of the screen, it should scroll by x amount of pixel, same goes to the lower half part of the screen. Here's what I did: Activity: @Override public boolean dispatchTouchEvent(MotionEvent event) { // if(mComicViewerFragment != null) // mComicViewerFragment.consumeEvent(event); mScaleDetector.onTouchEvent(event); if(event.getAction() == MotionEvent.ACTION_DOWN) { int y = (int) event.getY();

How to create auto adjust grid layout using android RecyclerView

杀马特。学长 韩版系。学妹 提交于 2019-12-05 07:21:38
问题 I want to create auto adjust columns like above image Grid Layout using RecyclerView. 回答1: At last, I have done it using FlexboxLayout ///Gradle import/// compile 'com.google.android:flexbox:0.3.1' public class MainActivity extends AppCompatActivity { List<String> list_text=new ArrayList<>(); FlexboxLayout container; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); container=findViewById(R.id.v_container

RecyclerView not scrolling to the bottom

无人久伴 提交于 2019-12-05 05:03:19
I followed the recyclerview guidelines and built one for the app I am making, but it does not scroll to the bottom for some reason. I compared it with google code snippets, as well as other code snippets online and can't see the difference. I have posted a picture and the code I am using. I am using tabs, therefore the recyclerview is populated in a fragment. What the app looks like: http://imgur.com/H5uOLFR the adapter class: public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> { private List<Group> groups; // Provide a reference to the views for each data item // Complex

RecyclerView reverse endless scrolling

断了今生、忘了曾经 提交于 2019-12-05 04:45:05
I'm creating a chat app and I am trying to implement endless scrolling for RecyclerView in a reversed manner, like start from the bottom and scroll up, when top is reached, load more. When the user opens the chat screen, the app gets the last 20 messages and scrolls to the bottom by default. I want to get more messages from the server as the user scrolls up. The following is just a generic endless scrolling code i am testing with: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); layoutManager = new

Last Item in recyclerview is cut off

◇◆丶佛笑我妖孽 提交于 2019-12-04 20:37:03
问题 I am using recyclerview to display a list of items and constraint layout is the parent view. The layout is displayed below: <?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="match_parent"> <!-- Load the toolbar here

Android Support Repository 23.2.1 RecyclerView error [duplicate]

旧城冷巷雨未停 提交于 2019-12-04 19:30:33
This question already has answers here : RecyclerView items with big empty space after 23.2.0 (4 answers) Closed 3 years ago . After update my support libraries 23.2.1, I encountered a problem. Even I didn't change any code only library update, my recyclerview item's become not shown. Only first item shown, others not shown. I have no idea why it is not show all elements. Is there anybody encounters this problem and how to fix it? Before library update After library update Note: Unfortunaley I couldn't change my IDE Eclipse to Android Studio. There was a change in the support library 23.2.1

Switch between RecyclerView layouts when click on AlertDialog item list

时光总嘲笑我的痴心妄想 提交于 2019-12-04 10:14:26
I have three different layouts cardsListLayout , titleLayout , cardMagazineLayout and there may be more in the future, which used as a views on onCreateViewHolder method. I want to switch between views in onCreateViewHolder method so when user choose from AlertDialog list this onOptionsItemSelected in MainActivity Where there is menu Item "change the layout" so that when the user presses it it appears AlertDialog list @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == R.id.change_layout) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder

How to make a page indicator for horizontal recyclerview

人走茶凉 提交于 2019-12-04 07:42:17
问题 Any idea how to create a page indicator for recyclerview list ? 回答1: You can add an indicator by using RecyclerView.ItemDecoration. Just draw some lines or circles at the bottom and use layoutManager.findFirstVisibleItemPosition() to get the current active item. Since pagers tend to fill the whole width this is an accruate way of getting the displayed item. This also allows us to calculate the scrolling distance by comparing the childs left edge to the parents. Below you find a sample