XML : How to make button in listview fit any screen

Am working on an xml code, but am having 2 issues, a. making the button fit to screen properly b.removing the space between the buttons. How do I make the button in a list-view fit to any screen, and also how do I remove the space between the buttons.Please edit my code when answering, thanksenter image description here

  <?xml version="1.0" encoding="utf-8"?>  <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:app="http://schemas.android.com/apk/res-auto"     xmlns:tools="http://schemas.android.com/tools"     android:id="@+id/content_main"     android:layout_width="match_parent"     android:layout_height="match_parent"     app:layout_behavior="@string/appbar_scrolling_view_behavior"     tools:context="org.cepfonline.lwponlineforum.activities.MainActivity"     tools:showIn="@layout/app_bar_main">    <LinearLayout      android:layout_width="match_parent"      android:layout_height="match_parent"      android:orientation="vertical" >        <LinearLayout          android:layout_width="match_parent"          android:layout_height="0dp"          android:layout_weight="1"          android:orientation="vertical">            <Button              android:id="@+id/button01"              android:layout_width="match_parent"              android:layout_height="0dp"              android:layout_weight="1"/>            <LinearLayout              android:layout_width="match_parent"              android:layout_height="0dp"              android:layout_weight="1"              android:orientation="horizontal">                <Button                  android:id="@+id/Button02"                  android:layout_width="0dp"                  android:layout_height="match_parent"                  android:layout_weight="1"/>            </LinearLayout>            <Button              android:id="@+id/button03"              android:layout_width="match_parent"              android:layout_height="0dp"              android:layout_weight="1"/>            <LinearLayout              android:layout_width="match_parent"              android:layout_height="0dp"              android:layout_weight="1.00"              android:orientation="horizontal">                <Button                  android:id="@+id/button04"                  android:layout_width="0dp"                  android:layout_height="match_parent"                  android:layout_weight="1" />            </LinearLayout>            <Button              android:id="@+id/button05"              android:layout_width="match_parent"              android:layout_height="0dp"              android:layout_weight="1"/>            <LinearLayout              android:layout_width="match_parent"              android:layout_height="0dp"              android:layout_weight="1.00"              android:orientation="horizontal">                <Button                  android:id="@+id/button06"                  android:layout_width="0dp"                  android:layout_height="match_parent"                  android:layout_weight="1" />            </LinearLayout>        </LinearLayout>    </LinearLayout>    

No comments:

Post a Comment