android-fragments

Changing Toolbar and CollapsingToolbarLayout scroll flags programmatically

安稳与你 提交于 2020-04-09 08:48:28
问题 I have a single Activity android app with lots of fragments. When I'm showing a list screen I want to use the Toolbar with the, app:layout_scrollFlags="scroll|enterAlways" property. And in the detail fragments I want to use the CollapsingToolbarLayout with an image in it. Since it's a single Activity app, I have only one Toolbar . Is it possible to modify my layout programmatically to suit both cases? 回答1: Yes. Let's say you are going from the CollapsingToolbarLayout fragment to the Toolbar

Changing Toolbar and CollapsingToolbarLayout scroll flags programmatically

房东的猫 提交于 2020-04-09 08:42:51
问题 I have a single Activity android app with lots of fragments. When I'm showing a list screen I want to use the Toolbar with the, app:layout_scrollFlags="scroll|enterAlways" property. And in the detail fragments I want to use the CollapsingToolbarLayout with an image in it. Since it's a single Activity app, I have only one Toolbar . Is it possible to modify my layout programmatically to suit both cases? 回答1: Yes. Let's say you are going from the CollapsingToolbarLayout fragment to the Toolbar

Add same fragment second time (add more then one time fragment) then RecyclerView scroll lagging

房东的猫 提交于 2020-04-05 06:48:13
问题 Add same fragment second time (add more then one time fragment) then RecyclerView scroll lagging I am using fragment reusability .but add second time fragment then start this problem. I am remove image load library but not any improvement i am face same problem. I am also check this link click add fragment then facing this problem. but replace fragment then not facing this problem more add fragment then RecyclerView lagging. i think fragment memory issue Every time user click see all related

SharedViewModel from viewpager2 and my parent Fragment

不打扰是莪最后的温柔 提交于 2020-03-25 17:56:31
问题 So, I have one fragment, lets call it Fragment A, in which I need it to be the main host of my sharedviewmodel. So I have it like this class FragmentA:Fragment() { private val model: SharedViewModel by viewModels() } Now, inside Fragment A, I set viewpager2 Adapter private fun setupViewPagerWithTabLayout( productList: MutableList<Producto>, drinkList: MutableList<Producto> ) { val fragmentList = listOf( FragmentProducts.newInstance(productList), FragmentProducts.newInstance(drinkList))

Interaction betweens Fragments and Activity

生来就可爱ヽ(ⅴ<●) 提交于 2020-03-23 12:00:20
问题 I'm having some difficulty facing the interactions between Fragments and between Fragments and my Activity, especially ClickListener -wise. I'm developing a Calculator app composed of 2 fragments: one Fragment contains all the Buttons (numbers and operators) the other contains the 2 TextViews (operation and result) The goal here is to make these two Fragments communicate between each other. I'm supposed to send characters and strings to a TextView until I click the on the "equals" button (on

Fragment Unit Testing: launchFragment throws ClassCastException

半城伤御伤魂 提交于 2020-03-23 11:55:04
问题 I'm trying to call methods within my Fragment class in my unit test but I keep getting the error java.lang.ClassCastException: androidx.fragment.app.testing.FragmentScenario$EmptyFragmentActivity cannot be cast to com.nu.rms.inspections.ui.activity.InspectionActivity I'm following Google's docs. I'm confused why the empty fragment activity is having a cast attempted to become my InspectionActivity (the parent activity the fragment resides in), perhaps this is expected? What can I do to

How to implement searchmenu in a fragment?

无人久伴 提交于 2020-03-22 23:19:02
问题 The bounty expires in 7 days . Answers to this question are eligible for a +50 reputation bounty. Sanidhya Setu is looking for an answer from a reputable source : Explain properly in detail with edited code. I followed this video: https://codinginflow.com/tutorials/android/searchview-recyclerview This is my fragment which is like MainActivity : public class cgpa_frag extends Fragment { RecyclerView recyclerview; adapter_cgpa ac; ArrayList<POJO> cgpaArrayList = new ArrayList<>(); public cgpa

How to implement searchmenu in a fragment?

此生再无相见时 提交于 2020-03-22 23:18:11
问题 The bounty expires in 7 days . Answers to this question are eligible for a +50 reputation bounty. Sanidhya Setu is looking for an answer from a reputable source : Explain properly in detail with edited code. I followed this video: https://codinginflow.com/tutorials/android/searchview-recyclerview This is my fragment which is like MainActivity : public class cgpa_frag extends Fragment { RecyclerView recyclerview; adapter_cgpa ac; ArrayList<POJO> cgpaArrayList = new ArrayList<>(); public cgpa

TabLayout: How to load all the tabs or only swipe refresh occur

限于喜欢 提交于 2020-03-22 05:50:17
问题 I have an activity and i implement the android TabLayout with recyclerview. I implemented three fragments for the three tabs of the TabLayout. The default load behavior of the TabLayout it will load and cache the neighbor tab but not the one that already loaded. let's say Fragment A, B and C correspond to tab 1, 2 and 3 respectively. When users visit tab 1 ---> Fragment A and B loaded When users visit tab 2 ---> Fragment C loaded But when users visit tab 1 again --> Fragment A load again.

TabLayout: How to load all the tabs or only swipe refresh occur

≯℡__Kan透↙ 提交于 2020-03-22 05:49:58
问题 I have an activity and i implement the android TabLayout with recyclerview. I implemented three fragments for the three tabs of the TabLayout. The default load behavior of the TabLayout it will load and cache the neighbor tab but not the one that already loaded. let's say Fragment A, B and C correspond to tab 1, 2 and 3 respectively. When users visit tab 1 ---> Fragment A and B loaded When users visit tab 2 ---> Fragment C loaded But when users visit tab 1 again --> Fragment A load again.