pihu
pihu

Reputation: 93

Not able to display buttons in the screen

enter image description hereI am having a screen which has many layouts having title,list view ,comment and buttons but buttons are not getting displayed at all,after list view display I am getting a huge amount of empty space after which comment is getting displayed and buttons are not seen ,this is my code.

<?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="vertical"
    android:background="@android:color/white">



    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:orientation="vertical"
            android:layout_margin="10dp" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_gravity="center_vertical"
                android:layout_weight="1"
                android:text="12345617890" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_gravity="center_vertical"
                android:layout_weight="1"
                android:fontFamily="@android:color/black"
                android:text="Ramakrisha Tripati" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_gravity="center_vertical"
                android:layout_weight="1"
                android:text="9876543210" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:gravity="right"
            android:layout_weight="1"
            android:layout_margin="10dp"
            android:orientation="vertical" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="13/1/2015" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="Rohit Sharma" />
        </LinearLayout>

    </LinearLayout>
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="55dp"
        android:orientation="horizontal"
        android:background="@android:color/holo_orange_light">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="item#\nstyle#"
            android:layout_weight="1"/>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="M Wt\nD Wt\nCS Wt"
            android:layout_weight="1"/>


        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Making\nD Rate\nCS Rate"
            android:layout_weight="1"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Margin\nDis %\nDiscount"
            android:layout_weight="1"/>
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="GT\nFSP"
            android:layout_weight="1"/>
    </LinearLayout>

    <LinearLayout  android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <ListView android:id="@+id/listView"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:divider="#00000000"
            android:dividerHeight="5dp"
           />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textSize="25dp"

            android:text="Comment" />
        <EditText
            android:id="@+id/editText2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="15dp"
            android:ems="10"
            android:hint="Comment goes here"
            android:inputType="textMultiLine" />

        </LinearLayout>

        <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:onClick="accept"
            android:src="@drawable/accept"
            />


</LinearLayout>

Upvotes: 0

Views: 51

Answers (2)

muditagarwal88
muditagarwal88

Reputation: 548

I have modified your layout code and now the button has appeared.

<?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:background="@android:color/white"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:layout_weight="1"
            android:orientation="vertical" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_gravity="center_vertical"
                android:layout_weight="1"
                android:text="12345617890" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_gravity="center_vertical"
                android:layout_weight="1"
                android:fontFamily="@android:color/black"
                android:text="Ramakrisha Tripati" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_gravity="center_vertical"
                android:layout_weight="1"
                android:text="9876543210" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:layout_weight="1"
            android:gravity="right"
            android:orientation="vertical" >

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="13/1/2015" />

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="Rohit Sharma" />
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="55dp"
        android:background="@android:color/holo_orange_light"
        android:orientation="horizontal" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="item#\nstyle#" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="M Wt\nD Wt\nCS Wt" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Making\nD Rate\nCS Rate" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="Margin\nDis %\nDiscount" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:text="GT\nFSP" />
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <ListView
            android:id="@+id/listView"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1"
            android:divider="#00000000"
            android:dividerHeight="5dp" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Comment"
            android:textSize="25dp" />

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" >

            <EditText
                android:id="@+id/editText2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="15dp"
                android:ems="10"
                android:hint="Comment goes here"
                android:inputType="textMultiLine" />

            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_margin="15dp"
                android:onClick="accept"
                android:src="@drawable/accept" />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

Upvotes: 1

Bar Sagiv
Bar Sagiv

Reputation: 23

Just put your main LinearLayout inside scrollview and you will see thr buttons.

And if not so maybe your image is so small or transparent. check with another image maybe.

Upvotes: 1

Related Questions