Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

how to add animation to nivation component android

in xml code:
<fragment
    android:id="@+id/specifyAmountFragment"
    android:name="com.example.buybuddy.buybuddy.SpecifyAmountFragment"
    android:label="fragment_specify_amount"
    tools:layout="@layout/fragment_specify_amount">
    <action
        android:id="@+id/confirmationAction"
        app:destination="@id/confirmationFragment"
        app:enterAnim="@anim/slide_in_right"
        app:exitAnim="@anim/slide_out_left"
        app:popEnterAnim="@anim/slide_in_left"
        app:popExitAnim="@anim/slide_out_right" />
 </fragment>



If you want to add animation through programmatically

NavOptions.Builder navBuilder =  new NavOptions.Builder();
navBuilder.setEnterAnim(R.anim.slide_left).setExitAnim(R.anim.slide_right).setPopEnterAnim(R.anim.slide_left).setPopExitAnim(R.anim.slide_right);

//Inside Activity
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
navController.navigate(R.id.destinationFragmentId,null,navBuilder.build());
//Inside Fragment
NavHostFragment.findNavController(YoutFragment.this)
                            .navigate(R.id.destinationFragmentId, null, navBuilder.build());
Comment

PREVIOUS NEXT
Code Example
Java :: simulate mouse click java 
Java :: Panel Slider for java swing 
Java :: How to efficiently invert a binary tree, in Java? 
Java :: programatically close a jframe 
Java :: actionlistener java 
Java :: java array swap 
Java :: get id of html tag by class 
Java :: java print type of object 
Java :: public static int to String java 
Java :: arrange item center android studio linear layout 
Java :: android java optional arguments 
Java :: java stop execution 
Java :: fabricmc spawn item 
Java :: why java is popular 
Java :: convert set to list java 
Java :: primefaces calendar min date validation 
Java :: java split string on two or more spaces except for words in quotes 
Java :: how to get contacts permission in android 
Java :: fibonacci sequence in java recursion 
Java :: java get current date 
Java :: How to efficiently multiply two numbers represented as Strings, in Java? 
Java :: Java Using forName() method 
Java :: cloning of list in java 
Java :: array to list 
Java :: Get the SUM of integers in List JAVA 
Java :: how to take an element out of an array at a certain index in java 
Java :: Get the first day of the current month in Java 
Java :: java boolean 2d array 
Java :: how to know java version in cmd 
Java :: recyclerview stop scrolling 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =