1. Are you ready for the Galaxy S20? Here is everything we know so far!

How to display fragment in sections

Discussion in 'Introductions' started by jrahma, Dec 11, 2013.

  1. jrahma

    jrahma Newbie
    Thread Starter

    Hi,

    I created a template using the AndroidStudio. The app template I choosed to have an action bar. It created 3 sections with one fragment_main

    here is the code was created:

    [HIGH]public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_main, container, false);
    // TextView textView = (TextView) rootView.findViewById(R.id.section_label);
    // textView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER)));
    return rootView;
    }
    [/HIGH]

    I want to know how can I display different layout for every sections so home_section (0) will display fragment_main and contact_section (1) will show the fragment_contact?


    Thanks,
    Jassim
     



    1. Download the Forums for Android™ app!


      Download

       
  2. Digital Controller

    Digital Controller The Real Bass Creator

    Welcome to the forums :)

    Unfortunately I have never really developed anything on android before so you might want to visit our dev forum for more assistance: Application Development - Android Forums
     
  3. Rush

    Rush {<>}~{<>}

    Thanks for joining our community. ;)
     
Loading...
Similar Threads - display fragment sections
  1. Christopher Clayton
    Replies:
    1
    Views:
    249
  2. JamesJoey
    Replies:
    0
    Views:
    349
  3. Christopher Clayton
    Replies:
    0
    Views:
    369
  4. 2heaVens
    Replies:
    0
    Views:
    548
  5. halfbeing
    Replies:
    6
    Views:
    442
  6. IrvineGuy
    Replies:
    3
    Views:
    597
  7. wrgy
    Replies:
    1
    Views:
    263
  8. KaneAndTheHumanRace
    Replies:
    8
    Views:
    392
  9. Tony Me
    Replies:
    1
    Views:
    913
  10. Nitrogen247
    Replies:
    0
    Views:
    1,604

Share This Page

Loading...