include - How do I fill the width of the screen with my toolbar using an Android GridLayout? -


i'm trying fill width of screen ui toolbar, in gridlayout. output shown below. somehow toolbar getting truncated, please advise.

enter image description here

below code xml file:

<?xml version="1.0" encoding="utf-8"?>  <gridlayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/gridlayout1"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:columncount="4"     android:orientation="horizontal"     android:usedefaultmargins="true"     tools:context=".cardviewactivity">  <include     android:id="@+id/toolbar"     android:layout_height="match_parent"     android:layout_width="match_parent"     android:layout_columnspan="4"     layout="@layout/toolbar" > </include>  <textview         android:id="@+id/createskycard"         android:layout_column="0"         android:layout_row="0"         android:layout_columnspan="3"         android:layout_margintop="80dp"         android:layout_gravity="center_horizontal"         android:textcolor="#ffffff"         android:text="create skycard"         android:textappearance="?android:attr/textappearancelarge"/> ... </gridlayout> 

it better if use linearlayout root, following :

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"    xmlns:tools="http://schemas.android.com/tools"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:orientation="vertical" >     <include        android:id="@+id/toolbar"        android:layout_width="match_parent"        android:layout_height="match_parent"        android:layout_columnspan="4"        layout="@layout/toolbar" >    </include>     <gridlayout        android:id="@+id/gridlayout1"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:columncount="4"        android:orientation="horizontal"        android:usedefaultmargins="true"        tools:context=".cardviewactivity" >          <textview             android:id="@+id/createskycard"            android:layout_column="0"            android:layout_columnspan="3"            android:layout_gravity="center_horizontal"            android:layout_margintop="80dp"            android:layout_row="0"            android:text="create skycard"            android:textappearance="?android:attr/textappearancelarge"            android:textcolor="#ffffff" />     </gridlayout>  </linearlayout> 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -