Add user draggable fragment in android java - java

I want to add the draggable fragment in my android app which have two fragments in vertical linear layout so that user can able to resize or drag the fragment with middle line between them

Related

Fragment showing nothing when starting my app for first time

I have an app with bottom navigation fragment activity
I have placed text views and buttons on my home fragment.
further these fragments are placed in a frame layout.
when I launch my app my home fragment shows nothing just blank screen it loads everything when I
switch between fragments.
I want to fix this, so that when I launch my app everything that is on my home fragment shows up.
because you didn't specify the first fragment to show,
in the onCreate you have to do this :
first checked the bottomNavigation item, that you want to start with :
bottomNavigation.getMenu().findItem(R.id.item).setChecked(true);
then put the first fragment in frame layout

Add Google Map to a button of bottom navigation bar

I try to put the bottom navigation bar under Google Map and I can't. When I tap the second button of navigation bar I want to open google map fragment but the bar stays at the bottom. Does anyone know how it can be done?
Here is an example of exactly what I want:
My app uses a bottom navigation layout and loads up three fragments (on one of them is a google map fragment), hence the bottom navigation menu stays there for all the three fragment of the app!
If you want to have a screen where the bottom navigation isn't present, why not use an activity with a layout without a bottom navigation view for that screen ? The user will just navigate back to the previous activity when the job is done.

How to handle Swipe and Click event in the same cardview - Android

I am working on a android app, which has card swiping functionality like Tinder. In each cards, I'm having a imageview, which on click, opens in full screen. My problem is when I try to swipe, the image view considers it as a click event and opens the image in full screen.
I'm having my code for imageview onclick in the card swipe adapter and the code for swipe in the main activity that uses the card swipe adapter. How can I restrict the child view from consuming the parent's event?

How to show a fixed number of tabs at a time in Android Material Design tabs?

I have used the Android Design Support library and implemented tabs in my android app using tablayout, fragments and viewpager. Tab sliding is working perfectly. But when I add more tabs (say 7), those tabs reduce their width and adjust themselves. How to show only 3 tabs at a time and show the next three when the user slides from 3rd to 4th tab?
In your MainActivity
ViewPager mpager;
TabPageAdapter adapter = new TabPageAdapter(getSupportFragmentManager(), list);
mtabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
mpager.setOffscreenPageLimit(list.size());
mpager.setAdapter(adapter);
In your xml TabLayout set
app:tabMode="scrollable"
you can use sliding tablayout
http://www.tutorialsbuzz.com/2015/04/Android-Material-Design-Sliding-TabLayout.html

android - slide relativelayout to the side with static buttons

In my Activity I have two RelativeLayouts and two buttons. When you first open the Activity, you have to see a RelativeLayout and the buttons. Then you can slide the RelativeLayout to the right or to the left. The buttons don't move. While sliding, you see the other RelativeLayout below. After a completed slide you see the full RelativeLayout that was below.
How can I implement this in my Android application (min SDK version 14)?
Code examples are a big plus, but not necessary. It is ok to show me the way :)
There's something called a navigation drawer which comes as a template in Android Studio. There are also many sliding menu libraries out there: https://android-arsenal.com/search?q=sliding specifically you might look at https://android-arsenal.com/details/1/1429
If you want to do it from scratch, it'll go something like: have one layout, say a Frame Layout as your root. Then you add the two Relative Layouts and your buttons. Then you need to implement a OnTouchListener in your activity and set on the relative layout that can slide: when the MotionEvent is ACTION_MOVE, you need to calculate the difference between the last touch event and the current touch event and then you can call translateX(dx) on the sliding relative layout where dx is the calculated difference.

Categories

Resources