0

I want to create a layout containing only a button, i want the layout to be transparent more even more, i want it 'not to be there', in other words, i want my layout to be only a not full size 'window' but only the button size, so i will be able to continue using any app open behind my app.

i tried :

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content" 
android:windowBackground="@android:color/transparent" 
android:windowIsTranslucent="true" >

<ToggleButton android:id="@+id/lockButton"
    style="@style/lockToggle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true">
</ToggleButton>

The background is really transparent but still a layer and the app in the back is not usable.

SagiLow
  • 5,721
  • 9
  • 60
  • 115
  • Your app in the background is not usable because as soon as you open this app you are trying to create, any other foreground app will go into its `onPause` state (and I believe it will even go to `onStop`) in which case you will no longer be able to interact with it. Check [here](http://www.herongyang.com/Android/Activity-onCreate-and-Callback-Methods.html) for more on the lifecycle on an app. AFAIK this isn't possible... – TronicZomB Mar 29 '13 at 13:21
  • 1
    Do you need this: http://stackoverflow.com/questions/2176922/how-to-create-transparent-activity-in-android ? – nfirex Mar 29 '13 at 13:23
  • Or this: https://github.com/pingpongboss/StandOut ? – nfirex Mar 29 '13 at 13:38

1 Answers1

1

As u need to operate other apps , surely u need a service

Try to check about

Creating a system overlay window (always on top)

Community
  • 1
  • 1
Viswanath Lekshmanan
  • 9,945
  • 1
  • 40
  • 64