Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Defining android activity as dialog with light theme

In my application I am defining one android activity as dialog.It looks proper.Only problem with that is my dialog appear in dark theme. I want to display it into light theme. I defined my activity dialog in following manner :

<activity
    android:theme="@android:style/Theme.DeviceDefault.Dialog.MinWidth"
    android:name="com.example.dialog"
    android:label="@string/title_activity_list" 
    >
</activity>

How to do this. Any solution. Need Help. Thank you.

like image 968
nilkash Avatar asked Dec 15 '22 07:12

nilkash


2 Answers

You need to use Holo Light Dialog theme:

<activity
    android:theme="@android:style/Theme.Holo.Light.Dialog"
    android:name="com.example.dialog"
    android:label="@string/title_activity_list" />
like image 109
silvia_aut Avatar answered Feb 09 '23 06:02

silvia_aut


Way around is to define custom theme into style xml, check below code:-

Style:

<style name="Theme.D1NoTitleDim" parent="android:style/Theme.Translucent">
<item name="android:windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:background">#22000000</item>
</style>

manifest:

<activity
   android:theme="@style/Theme.D1NoTitleDim"
    android:name="com.example.dialog"
    android:label="@string/title_activity_list" 
    >
</activity>
like image 27
RobinHood Avatar answered Feb 09 '23 06:02

RobinHood