-
-
Save akinkarayun/5e9008304a7244e2514026b0f05b446a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity { | |
TextView datailsText; | |
LinearLayout layout; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
datailsText = findViewById(R.id.details); //get the views | |
layout = findViewById(R.id.layout); //get the views | |
layout.getLayoutTransition().enableTransitionType(LayoutTransition.CHANGING); //give transition type, you can change this based on your need | |
} | |
public void expand(View view) { //the function that given to onclick event | |
int v = (datailsText.getVisibility() == View.GONE) ? View.VISIBLE : View.GONE; | |
TransitionManager.beginDelayedTransition(layout, new AutoTransition()); | |
datailsText.setVisibility(v); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment