Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Android custom style not showing on a LinearLayout
- <style name="Dialog"
- parent="@android:style/Theme.Dialog">
- <item name="android:windowBackground">@null</item>
- <item name="android:windowNoTitle">true</item>
- <item name="android:windowIsFloating">true</item>
- <item name="android:shadowColor">#FF000000</item>
- <item name="android:shadowDx">10</item>
- <item name="android:shadowDy">10</item>
- <item name="android:shadowRadius">10</item>
- </style>
- <?xml version="1.0" encoding="utf-8"?>
- <!-- custom dialog -->
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:id="@+id/layout_root"
- android:orientation="vertical"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:gravity="center"
- android:background="@color/grey"
- style="@style/Dialog">
- ...
- public CustomDialog create() {
- Typeface tf = Typeface.createFromAsset(context.getAssets(), "fonts/IMPACT.TTF");
- LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- // instantiate the dialog with the custom Theme
- final CustomDialog dialog = new CustomDialog(context, R.style.Dialog);
- View layout = inflater.inflate(R.layout.custom_dialog, null);
- dialog.addContentView(layout, new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
- dialog.setContentView(layout);
- TextView text = (TextView) layout.findViewById(R.id.text);
- text.setTypeface(tf);
- text.setText("Add this game to your cal, or share it on Facebook.");
- return dialog;
- }
- final CustomDialog dialog = new CustomDialog(context, R.style.Dialog);
Advertisement
Add Comment
Please, Sign In to add comment