Styled Background Used In Layout Of Transparent Popupwindow Not Working
Solution 1:
Activity is the only Context on which the themes defined in your manifest are actually attached. Any other instance will use the system default theme to inflate your views, leading to a display output you probably didn’t expect.
This is why getApplicationContext()
will not properly set your theme.
Solution 2:
I ultimately narrowed down the problem to my passing the context returned by getApplicationContext()
to the PopupWindow
constructor. If I pass LoginActivity.this
as the context, things work as expected and I'm able to change backgrounds according to theme selected in the parent activity.
Still beats me why getApplicationContext()
would not have the theme I set on it. Food for thought.
Solution 3:
Put tips_root background shap xml in res/drawable.
Use android:background
instead of style="?Tips_Background"
as:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/tips_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="8dip"
android:orientation="horizontal"
android:background="@drawable/Tips_Background" >
Post a Comment for "Styled Background Used In Layout Of Transparent Popupwindow Not Working"