There have been similar questions to this related to dialog activities and how to make these full screen, but I have a slightly different problem. I want these dialogs to wrap the activity content.
Now, the "dialog activities" all inherit the following theme,
<style name="tabDialog" parent="@android:Theme.Dialog">
<item name="android:windowBackground">@drawable/panel_background</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">false</item>
</style>
Example of activity definition in manifest,
<activity android:name=".TabSettingsActivity"
android:theme="@style/tabDialog" android:excludeFromRecents="true"
android:configChanges="keyboardHidden" />
The content view parent view is defined like this,
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:background="@layout/dialog_rounded_background"
android:orientation="vertical">
and all the child views in the layout also specify wrap_content for both dimensions. I have tried using a RelativeLayout as the parent as well, but same same.
After the content view has been set in onCreate of the activity, I do this
getWindow().setLayout(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
None of these things actually seem to make any difference at all. The problem is mostly related to the dialog height, which is about 50% bigger than necessary. Half of the dialog is just dead space. Setting the root view dimensions to hardcoded dp units solves the problem, but this seems like a workaround rather than a solution.
Any ideas anyone?
Thanks in advance.
Cheers
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With