Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.mycompany.myapp4;
- public class MainActivity extends Activity {
- boolean isExpanded = false;
- LinearLayout moreDataLayout;
- private CardView mCard;
- private TextView TxtOne, HiddenTxtTwo, viewMore;
- @Override
- protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- viewMore = findViewById(R.id.viewMoreText); moreDataLayout=findViewById(R.id.moreDataLayout); mCard=findViewById(R.id.stateDataCard); TxtOne=findViewById(R.id.txtOne); HiddenTxtTwo=findViewById(R.id.txtTwo);
- mCard.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (isExpanded) { TransitionManager.beginDelayedTransition(mCard, new AutoTransition()); moreDataLayout.setVisibility(View.GONE); viewMore.setVisibility(View.VISIBLE);
- isExpanded = false;
- } else { TransitionManager.beginDelayedTransition(mCard, new AutoTransition()); viewMore.setVisibility(View.GONE); moreDataLayout.setVisibility(View.VISIBLE);
- isExpanded = true;
- }
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement