I have a Theme.Dialog function that represents a list of devices for a user. this operation uses a ListView with a dynamically created ArrayAdapter to display a list of devices. For some reason, however, the ListView (and therefore the activity itself) does not resize for its correct contents. Instead, it acts as if it has a typing width of about half the screen (and this is saved on different devices with different screen sizes). However, I cannot find out for life where this is installed.
Can anyone see what I am missing? (I tried to remove unnecessary bits from the following code)
Here is my activity:
public class DeviceListActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
Here is device_list.xml:
<?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="fill_parent" android:orientation="vertical" > <ListView android:id="@id/paired_devices" android:layout_width="wrap_content" android:layout_height="fill_parent" android:stackFromBottom="true" android:background="#0000FF"/> </LinearLayout>
Here is the relevant part of my AndroidManifest.xml:
<activity android:name=".DeviceListActivity" android:configChanges="keyboardHidden|orientation" android:label="too wide" android:theme="@android:style/Theme.Dialog"> </activity>
And here is device_name.xml (which is used to initialize the ArrayAdapter:
<?xml version="1.0" encoding="UTF-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="5.0dip" android:textSize="18.0sp" />
And if you are stuck with reading the question so far, I'm already thankful.
Here's the end result (with the rest of my application in the background): 
source share