skip to Main Content

I want to create a series of buttons that when clicked, expands into a plot of body of text. Not sure how to go about making this.

Figma Design

2

Answers


  1. I’ve achieved this using an external library: ExpandableLayout

    Login or Signup to reply.
  2. Well you don’t need to worry, you can just put all of your views inside a parent layout (it works as button) and you set their visibility to GONE, then when the parent is clicked you change their visibility to VISIBLE for example:

    --Parent---
              |---View 1: Visible (your title or text...)
              |---View 2: Gone 
              |---View 3: Gone
              |.... other views are all gone
    

    when Parent is clicked:

    --Parent---
              |---View 1: Visible (your title or text...)
              |---View 2: Visible
              |---View 3: Visible
              |.... other views are all visible
    

    you can achieve that easily by:

    view.setVisibility(View.GONE);
    
    view.setVisibility(View.VISIBLE);
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search