android - Series of buttons horizontally -


i new android development , appreciated, want display 2 rows of 6 buttons shown in image below, tried following code, when run it, doesn't show app( blank screen appears), first linearlayout horizontal , second 1 verticalenter image description here

<linearlayout             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:orientation="vertical" >              <linearlayout                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_marginleft="5dp"                 android:layout_marginright="5dp"                   >                  <button                     android:id="@+id/button01"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/tenp" />                  <button                     android:id="@+id/button02"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/twentyp" />                  <button                     android:id="@+id/button03"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/thirtyp" />                  <button                     android:id="@+id/button04"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/fourtyp" />                  <button                     android:id="@+id/button05"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/fiftyp" />                  <button                     android:id="@+id/button06"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/sixtyp" />              </linearlayout>              <linearlayout                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:layout_marginleft="5dp"                 android:layout_marginright="5dp"                 >                  <button                     android:id="@+id/button1"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/plusone" />                  <button                     android:id="@+id/button2"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/minusone" />                  <button                     android:id="@+id/button3"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/plusfive" />                  <button                     android:id="@+id/button4"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/minusfive" />                  <button                     android:id="@+id/button5"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/plusten" />                  <button                     android:id="@+id/button6"                     android:layout_width="0px"                     android:layout_height="wrap_content"                     android:layout_weight=".2"                     android:padding="4dp"                     android:text="@string/minusten" />              </linearlayout>              <linearlayout                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:orientation="vertical" >              </linearlayout>         </linearlayout> 

try this:

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" >  <linearlayout     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:orientation="vertical" >      <linearlayout         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_marginleft="5dp"         android:layout_marginright="5dp"          >          <button             android:id="@+id/button01"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/tenp" />          <button             android:id="@+id/button02"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/twentyp" />          <button             android:id="@+id/button03"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/thirtyp" />          <button             android:id="@+id/button04"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/fourtyp" />          <button             android:id="@+id/button05"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/fiftyp" />          <button             android:id="@+id/button06"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/sixtyp" />      </linearlayout>      <linearlayout         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_marginleft="5dp"         android:layout_marginright="5dp"         >          <button             android:id="@+id/button1"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/plusone" />          <button             android:id="@+id/button2"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/minusone" />          <button             android:id="@+id/button3"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/plusfive" />          <button             android:id="@+id/button4"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/minusfive" />          <button             android:id="@+id/button5"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/plusten" />          <button             android:id="@+id/button6"             android:layout_width="0px"             android:layout_height="wrap_content"             android:layout_weight=".2"             android:padding="4dp"             android:text="@string/minusten" />      </linearlayout>  </linearlayout> 

you missed part xml:

<linearlayout     xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > 

Popular posts from this blog