Click here to Skip to main content
15,123,367 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys,

I am using a custom layout in android but in that i am facing a problems regarding layouts.
In my main.xml 1 have one LinearLayou in that one listview is there. And another list_row.xml hase 2 textview. The code runs very well but the issue is When i add the another layout in main.xml the problem is created and the app is force close.

I want to add multiple layout in main.xml with multiple buttons and listview.
Here i am attaching the code for main.xml

MAIN.XML
XML
 <?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:removed="@drawable/bg"
    android:orientation="vertical" >

    <RelativeLayout
        android:id="@+id/relativeLayout1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:removed="@drawable/topbar" >

        <Button
            android:id="@+id/btn_back1"
            android:layout_width="70dp"
            android:layout_height="50dp"
            android:background="@drawable/backbtn" />

        <Button
            android:id="@+id/btn_addorder"
            android:layout_width="70dp"
            android:layout_height="50dp"
            android:layout_alignParentRight="true"
            android:layout_alignParentTop="true"
            android:background="@drawable/addbtn" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="10dp"
            android:gravity="center"
            android:text="Order 1"
            android:textColor="#006699"
            android:textSize="20dp" />
    </RelativeLayout>

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

        <ListView
            android:id="@+id/lvResult"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
    </LinearLayout>

    <RelativeLayout
        android:id="@+id/rl"
        android:layout_width="wrap_content"
        android:layout_height="35dp"
        android:layout_alignParentBottom="true"
        android:removed="@drawable/topbar"
        android:gravity="center"
        android:orientation="vertical"
        android:padding="3dp" >

        <TextView
            android:id="@+id/textView1"
            android:layout_width="fill_parent"
            android:layout_height="30dp"
            android:layout_alignParentBottom="true"
            android:layout_alignTop="@android:id/tabcontent"
            android:gravity="center"
            android:text="Updated at Date,Time"
            android:textSize="20dp" />
    </RelativeLayout>

</LinearLayout>
Posted
Comments
Varsha Bhatia 12-Apr-13 8:52am
   
If i am using in main.xml

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

<ListView
android:id="@+id/lvResult"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>

Its works perfact but i add multiple layout it creates a problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900