Note that there are some explanatory texts on larger screens.

plurals
  1. POComplex Android UI design guidance needed (fragments)
    primarykey
    data
    text
    <p>I am developing an applications that is aimed at Tablets and Google TVs. It will be like many standard Google TV applications with a LeftNavBar and a top Search bar that is common to all application screens. It will look something like the following image:</p> <p><strong>Main Screen</strong> <img src="https://i.stack.imgur.com/7OuH7.png" alt="enter image description here"></p> <p>The RED area will be different for all other screens. It may contain data like following screens mockups:</p> <p><strong>Activity One loaded into main container</strong> <img src="https://i.stack.imgur.com/au3Np.png" alt="enter image description here"></p> <p><strong>Activity Two loaded into main container</strong> <img src="https://i.stack.imgur.com/KjDSB.png" alt="enter image description here"></p> <p>So you can see that completely different sections can be loaded in the main area.</p> <p>Screen 3 can be loaded as a detailed section when selecting any list item in Screen 2 (say in fragment list) OR it can be loaded as a result of selecting a tab (which will appear in LeftNavBar).</p> <p>Here is how I am trying to implement it.</p> <p><strong>Step 1.</strong> I Created a main Activity with the following XML:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="50dp" android:background="#9ccc" &gt; &lt;!-- Top Bar --&gt; &lt;/LinearLayout&gt; &lt;FrameLayout android:id="@+id/mainContainer" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1"&gt; &lt;!-- main Red Container that will load other Activities --&gt; &lt;/FrameLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p><code>mainContainer</code> is the RED container where I want to load the Activities. <code>LeftNavBar</code> will be added to this Activity as its the parent of All.</p> <p><strong>Step 2</strong> I created <code>ActivityOne</code> &amp; <code>ActivityTwo</code> with two &amp; three Fragments in them respectively (as shown in above second &amp; third image).</p> <p><strong>*Step 3</strong> I am trying to load the <code>ActivityOne</code> in main page's <strong>mainContainer</strong> FrameLayout... But I cannot add it.</p> <p>I tried by adding the <code>ActivityOne</code> to <code>mainContainer</code> as follows:</p> <pre><code>View v = (new ActivityOne()).getWindow().getDecorView(); FrameLayout mainContainer = (FrameLayout) findViewById(R.id.mainContainer); mainContainer.addView(v); </code></pre> <p>but the <code>getWindow()</code> returns <code>null</code>....</p> <p><strong>Other issue occurs because all the data comes from a remote services</strong> .. so please also suggest how would I be able to hold references to all the loaded Activities in <code>mainContainer</code> in a some kind of stack ... so I can just reload the already loaded activity instead of creating its new instance.. This will be used on BACK button press.</p> <p><strong>OR</strong></p> <p>Instead of loading an activity into the above RED container, I should create two Activities each with their own Fragments &amp; a LeftNavBar. This might be easier than the aforementioned approach. or this might be the only solution.... however I feel that saving state for BACK buttons might get messy .. but I will try implementing this</p> <p>What would you do if you had to create this type of application? How would you design the UI layout for best performance/practice? </p> <p>Your suggestions in helping me setting this app's layout are much appreciated.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload