Reputation: 11
I have a MultiSelectListPreference that's populated dynamically, so the number of entries can vary. When there is only one entry in the list, there's a gap between the entry and the buttons at the bottom of the dialog. Is it possible to remove the gap between the entry and the buttons?
Here's an example of what I am referring to:
https://i.sstatic.net/2oqiA.png
For comparison, here's what the dialog looks like with 2 entries and no gap present:
https://i.sstatic.net/7BHa3.png
I'm assuming the issue is caused by a minimum height of one of the layout components, but I'm struggling to find a solution.
Any help is appreciated! :-)
Upvotes: 0
Views: 183
Reputation: 11
Since no one seems to have a solution, I thought I'd chime in with what I found.
The issue is caused by a change in Android 4.2 that added a minHeight property to the contentPanel in alert_dialog_holo.xml. Here's the relevant portion of the file:
<LinearLayout android:id="@+id/contentPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:minHeight="64dp">
...
</LinearLayout>
There doesn't seem to be an easy fix other than using a custom dialog, so I'll leave it be since I don't think the additional code will be worth it to fix this cosmetic issue.
Upvotes: 1