android-recyclerview

ConstraintLayout as RecyclerView Items

北战南征 提交于 2019-12-06 02:13:15
问题 I use ConstraintLayout as RecyclerView item. But now there are some problems that are displayed on the real machine and in the preview is not the same The recyclerView item layout as follow: <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/foreground_item_undo" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color

Recyclerview - Top item should overlap next item and so on

偶尔善良 提交于 2019-12-06 02:01:35
I have set the negative margin for items like this:- public class ItemDecorator extends RecyclerView.ItemDecoration { private final int mSpace; public ItemDecorator(int space) { this.mSpace = space; } @Override public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { int position = parent.getChildAdapterPosition(view); if (position != 0) outRect.top = mSpace; } } This causes top item to stack lowest and next item after the top item overlaps it. I want top item to overlap its next item and so on. 来源: https://stackoverflow.com/questions/32906033

RecyclerView drawing offscreen, can't scroll bottom item into view

给你一囗甜甜゛ 提交于 2019-12-06 02:00:22
Using Design Support Library 22.2.1, with the following View hierarchy: <DrawerLayout android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true"> <CoordinatorLayout android:layout_width="match_parent" android:layout_height="match_parent"> <AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content"> <Toolbar android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" /> <TabLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:clipToPadding="false" app:tabGravity="fill

RecyclerView is not showing anything

这一生的挚爱 提交于 2019-12-06 01:52:01
In my application I am getting data from sqlite database and showing them using RecyclerView. This is my adapter :- public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.Holder> { private List<SentData> dataList = Collections.emptyList(); private LayoutInflater inflater; public RecyclerViewAdapter(Context context, List<SentData> dataList) { Log.d("array size", dataList.size()+""); this.dataList = dataList; inflater = LayoutInflater.from(context); } @Override public RecyclerViewAdapter.Holder onCreateViewHolder(ViewGroup viewGroup, int i) { View view = LayoutInflater

RecyclerView LinearLayout manager always returns -1 in landscape mode - findLastCompletelyVisibleItemPosition()

烈酒焚心 提交于 2019-12-06 01:49:27
问题 I'm using findLastCompletelyVisibleItemPosition() to determine the last visible item in my RecyclerView. Here is a code snippet of how I'm setting up my layout: mRecyclerView.setHasFixedSize(true); LinearLayoutManager mLayoutManager = new LinearLayoutManager(getContext()); mRecyclerView.setLayoutManager(mLayoutManager); Layout XML: <android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/swipe_container" android:layout_width=

Scroll RecyclerView Scroll to position always on top

拥有回忆 提交于 2019-12-06 01:43:21
问题 I'm using linear layout manager and RecyclerView with a LinearLayout Manager to populate some list of items. When I'm displaying the recyclerview for the first time and I use: linearLayoutManager.scrollToPosition(desiredindex); it scrolls to the top exactly where I want. Now here is the tricky part - When I'm scrolling to top of recyclerview (i.e. new items indices will be lower than the desiredindex ) and I call: linearLayoutManager.scrollToPosition(desiredindex); It still works fine, but

Replacing Fragment does not work properly while swipeRefresh is running

大憨熊 提交于 2019-12-06 01:16:12
I have fragment A which includes a SwipeRefresh and a RecycleView. When user click on an Item in RecycleView, I replace a new Fragment which is B: mAdapter.setOnItemClickListener(new MyAdapter.OnItemClickListener() { @Override public void onItemClick(View view, int position) { Item tem = mItems.get(position); // selected item Log.i(TAG, item.getTitle() + " clicked. Replacing fragment."); // We start the fragment transaction here. It is just an ordinary fragment transaction. getActivity().getSupportFragmentManager() .beginTransaction() .replace(R.id.content_fragment, FragmentB.newInstance(item,

Shared element transition don't have the expected behaviour

前提是你 提交于 2019-12-06 00:10:25
问题 I implemented the shared element transition between from an image in a RecyclerView to an image in a new Fragment. The RecyclerView is hosted in a fragment hosted by an Activity and the target fragment is hosted inside another Activity. When I click on my image, the transition is happening like expected and I get to my fragment. But when I click the back button, the transition is trying to put my image at the first position of my RecyclerView while it's currently displaying the image which is

RecyclerView Grid - define number of items per row in

我的梦境 提交于 2019-12-06 00:05:35
I'm typically against posting a question without code, but I have no code to show. I'm finally converting my project from listviews and gridviews to recyclerView. In one class, I use a small gridview to place items pulled from a server. The max number of items per row is 3, but the remainder needs to be on top. So if there's 5 items, top row has 2, bottom has 3. If there's 4 items, top row has 1, bottom has 3. My google-fu is failing me and I'm not able to find any examples with this type of customization. If somebody could point me in the right direction, I'll post my completed code for those

RecyclerView hides Actionbar when SoftKeyboard is opened

佐手、 提交于 2019-12-06 00:00:23
问题 I have the following Layout <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/container"> <com.example.SendMessageLayout android:id="@+id/chatMessageLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" /> <View android:id="@+id/separator" android:layout_width="match_parent"