I am running a service of type SYSTEM_ALERT_WINDOW
and i have inflated a layout to the service
private void createLayoutForServiceClass() {
inflater=(LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
windowManager=(WindowManager) getSystemService(WINDOW_SERVICE);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
//WindowManager.LayoutParams.TYPE_INPUT_METHOD |
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,// | WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.RIGHT | Gravity.TOP;
view = inflater.inflate(R.layout.area_selection, null);
windowManager.addView(view, params);
}
Now when i set the background of the layout it returns me the black background, i want the background to be fully transparent so that user can see that is running on the screen along with he/she can perform her task while he/she is not disturbed in doing the work.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#B94765">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/iv_cross"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="end"
android:src="@drawable/ic_close_black_24dp"/>
</LinearLayout>
<com.steelkiwi.cropiwa.CropIwaView
android:id="@+id/crop_view"
android:layout_width="match_parent"
android:layout_height="match_parent" /></LinearLayout>
Is it possible to set the background of the layout to fully transparent. I have made activity transparent,fragment transparent, dialog transparent but this is new to me can anyone suggest me good idea
Thank you for helping me.
Try using this in your layout xml:
Also, have a look at this similar question