Note that there are some explanatory texts on larger screens.

plurals
  1. POGridLayout Showing Differently In Activity and Fragment
    primarykey
    data
    text
    <p>I created an activity with GridLayout to show 4 buttons on the screen - they displayed in the centre of the screen both horizontally and vertically.</p> <p>I have now changed the activity to a fragment that shows inside Tabs using a guide found on <a href="http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/" rel="nofollow">http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/</a></p> <p><strong>But the tabs are showing all aligned to the top left hand side of the screen.</strong></p> <p>**I want a display with the 4 buttons in the middle of the screen both horizontally and vertically *</p> <hr> <pre><code> BTN 1 BTN 2 BTN 3 BTN 4 </code></pre> <hr> <p><strong>this is my layout file of the fragment</strong></p> <pre><code>&lt;GridLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:columnCount="2" android:orientation="horizontal" &gt; &lt;Button android:id="@+id/Btn_Show" android:text="Btn Show" android:layout_width="100dp" android:layout_height="100dp" android:layout_column="0" android:drawableTop="@drawable/ic_launcher" /&gt; &lt;Button android:id="@+id/Btn_2" android:text="Btn 2" android:layout_width="100dp" android:layout_height="100dp" android:drawableTop="@drawable/ic_launcher" /&gt; &lt;Button android:id="@+id/Btn_3" android:text="Btn 3" android:layout_width="100dp" android:layout_height="100dp" android:drawableTop ="@drawable/ic_launcher" /&gt; &lt;Button android:id="@+id/Btn_4" android:text="Btn 4" android:layout_width="100dp" android:layout_height="100dp" android:drawableTop="@drawable/ic_launcher" /&gt; &lt;/GridLayout&gt; </code></pre> <p><strong>this is the main layout for the activity which includes the fragment as a tab</strong></p> <pre><code>&lt;android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;/android.support.v4.view.ViewPager&gt; </code></pre>
    singulars
    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.
    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