Im new to background services in android... i have managed to inflate an xml layout in a service like this
public class FloatingWindow extends Service{
WindowManager wm;
RelativeLayout ll;
LayoutInflater li;
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
// TODO Auto-generated method stub
super.onCreate();
final View myview;
li = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
wm = (WindowManager) getSystemService(WINDOW_SERVICE);
WindowManager.LayoutParams params = new WindowManager.LayoutParams(
WindowManager.LayoutParams.TYPE_INPUT_METHOD |
WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY,// | WindowManager.LayoutParams.TYPE_SYSTEM_ALERT,
WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL,
PixelFormat.TRANSLUCENT);
/////////////////////////Another params
params = new WindowManager.LayoutParams(
750,1250,
WindowManager.LayoutParams.TYPE_PHONE,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.CENTER | Gravity.CENTER;
myview = li.inflate(R.layout.service_floating_window, null); // your layout here
wm.addView(myview, params);
params.x = 0;
params.y = 0;
But thats just inflating an xml layout... Can i get the code for how to make a service with a different shape just like the image below... like a semi circle and not the regular activity shape(Rectangle) i know i shouldn't be jumping so fast to such complex things but i just want to learn quickly and looking at code and understanding is the best way... So can someone please tell me how to achieve this?
