0

I have the following XML layout:

    <LinearLayout 
        android:id="@+id/map_locations_list"
        android:layout_width="300dp"
        android:layout_height="fill_parent"
        android:layout_marginLeft="8dp"
        android:layout_marginTop="8dp"
        android:layout_marginBottom="8dp"
        android:background="@color/black_shadow"
        android:layout_gravity="left">

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:orientation="vertical">
                <TextView
                    android:id="@+id/location_results_info"
                    android:layout_width="fill_parent"
                    android:layout_height="56dp"
                    android:background="@android:color/white"
                    android:text="Stuff goes here"
                    android:padding="10dp"
                />
                <ListView
                    android:id="@+id/locations_view"
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:layout_weight="1.0"
                />
                <TextView
                    android:layout_width="fill_parent"
                    android:layout_height="fill_parent"
                    android:text="this is a test" />
            </LinearLayout>
    </LinearLayout>

<fragment class="fragmentClass" 
    android:id="@+id/fragmentId" 
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>      

And the following Java code to load the ListView:

String lv_arr[]={"Android","iPhone","BlackBerry","AndroidPeople"};  
ListView locationsLV = (ListView)findViewById(R.id.locations_view);
locationsLV.setAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1 , lv_arr));

The ListView does not get loaded with any values, but it also does not throw an exception. I'm not sure what I'm doing wrong. I used this example as a basis for my code: http://www.androidpeople.com/android-listview-example

0

1 Answer 1

1

Check this XML and try first and then add other components its may be overllapping of components.............

   <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout android:id="@+id/locations_view"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <ListView android:id="@+id/ListView01"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />
    </LinearLayout>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.