android-recyclerview

how do i use both scroll view and RecyclerView in one xml layout android?

可紊 提交于 2019-12-10 11:01:46
问题 In my application i am using recycler view and scrollview in one layout. it is not working when i am using both these views. If i remove scroll view only the recycler view is working. Plese any one help me hoe to fix this issue. my code: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/r1" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/background" >

How to add a Onclick listener on a RecyclerView in Android Studio with Kotlin?

纵然是瞬间 提交于 2019-12-10 10:58:44
问题 so I want to have a onclicklistener for my RecyclerView in Android but I am not sure how I should do that. I have a CustomAdapterClass for my Workoutlist that looks like this: class CustomAdapter(val workoutList: ArrayList<workout>) : RecyclerView.Adapter<CustomAdapter.ViewHolder>() { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): CustomAdapter.ViewHolder { val v = LayoutInflater.from(parent.context).inflate(R.layout.list_layout, parent, false) return ViewHolder(v) }

Get recyclerview listener in another class

孤街醉人 提交于 2019-12-10 10:49:38
问题 I have a main activity that displays an ImageView and below that a RecyclerView . In the adapter for the RecyclerView I implemented onClickListner on the view holder and it is working fine. However I need the click to set the image in the main activity when the button is clicked but I cannot see anyway to implement a listner in the main activity to get the results from the adapter to the main activity. I tried the using the onClick as below but that gives a null pointer exception . class

Recyclerview Dynamic Sections not using any 3rd lib

杀马特。学长 韩版系。学妹 提交于 2019-12-10 10:28:31
问题 i want to add header to recycle view i am trying to achieve it using @Override public int getItemViewType(int position) { // depends on your problem if (position == 0 || position == 4) { return 2; } else { return 1; } } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // create a new view if (viewType == 1) { View itemLayoutView = LayoutInflater.from(parent.getContext()).inflate( R.layout.cardview_row, null); return new ViewHolder(itemLayoutView);

Android : RecyclerView row Visibility not working properly

笑着哭i 提交于 2019-12-10 10:12:21
问题 I am developing an android app (Android Studio). I want to implement Visibility GONE/VISIBLE in every row. In the image there are three recyclerView rows, I want to do the following things : There are two part in every row Heading & Details . When This Activity open all the rows details should hide. When I click on particular row , details of the row should appear by Visibility VISIBLE. When i again click on row details should disappear by Visibility GONE. Problem is : If i clicked on first

Recyclerview - Top item should overlap next item and so on

蓝咒 提交于 2019-12-10 10:00:22
问题 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

Calling notifyItemChanged() on a RecyclerView.Adapter from another class

北城以北 提交于 2019-12-10 09:56:49
问题 I have a RecyclerView in AdapterActivity . After clicking on any of its items, I update that item using my AlertDialogShow#UpdateStudent() method. My problem is that I can not refresh the Adapter inside the UpdateStudent() method using notifyItemChanged() . How can I refresh the Adapter from another class that does not have direct access to the Adapter ? In the AdapterActivity with the RecyclerView : holder.itemView.setOnLongClickListener(new View.OnLongClickListener() { @Override public

How to mimic view pager with recycler view?

做~自己de王妃 提交于 2019-12-10 09:23:16
问题 One advantage of ViewPager over RecyclerView is that it has a setPageTransformer() listener. Here you can manipulate the page and transform it to do neat animations between or while swiping. I would like mimic being able to transform a page while using RecyclerView. First, I mimic the behavior of ViewPager using LinearSnapHelper LinearSnapHelper snapHelper = new LinearSnapHelper() { @Override public int findTargetSnapPosition(RecyclerView.LayoutManager layoutManager, int velocityX, int

RecyclerView Sections and data from Firebase

落花浮王杯 提交于 2019-12-10 08:41:01
问题 Hi I'm working on an app, in it I have to populate a data recyclerview with Firebase, ready. Now I want to do is fill out a recyclerview with data firebase but has sections which would be the father that host data firebase, I'm a little lost with this, and I think it is in the adapter Recyclerview where not as do, I hope you can help me. Sorry for my English, it's not good. Thanks! and i am sorry for my english. 回答1: Use this library SectionedRecyclerViewAdapter to group your data into

How to set an Observer to Update Navigation Drawer after onActivityResult method's received an Intent result

╄→гoц情女王★ 提交于 2019-12-10 06:59:07
问题 In my app I want to update the Navigation Drawer with the username's nickname and email after he's logged in. From my MainActivity I am starting a LoginActivity with the startActivityForResult(intent, PICK_ACCOUNT_REQUEST); method to get the users registered or logged in. After the LoginActivity returns the Intent data result (his NAME and EMAIL ) back to MainActivity , the method onActivityResult() is called and there I try to update the class' global variables NAME and EMAIL with the newly