sab
sab

Reputation: 9977

Android list view not visible

I have my layout xml as

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingTop="10dip"
    android:paddingLeft="10dip"
    android:paddingRight="10dip">
    <!-- Editext for Search -->
    <EditText android:id="@+id/inputSearch"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:hint="Search.."
        android:inputType="textVisiblePassword"/>

    <ListView
        android:id="@+id/table_list_listView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/customshape">
    </ListView>
    <TextView android:id="@android:id/empty"        
        android:layout_width="wrap_content"        
        android:layout_height="wrap_content"        
        android:text="@string/no_servers"/>

</LinearLayout>

But when the activity is launched I am not able to see listview. Only Edittext is displayed.

Any help is appreaciated How can I fix this .

Upvotes: 0

Views: 41

Answers (1)

codeMagic
codeMagic

Reputation: 44571

Without seeing your java code, I would say it is because you haven't declared an orientation in your root layout. I am assuming that you want a vertical orientation, in which case you need in your root layout

android:orientation="vertical"`

By default, LinearLayout has a horizontal orientation. Since your width of your EditText is fill_parent, it takes up all of the width

Upvotes: 3

Related Questions