There are two activations, one opens on top of the other and there is a gridview on it, I want the top to be translucent (not completely transparent, not android: style / Theme.Translucent), I understood how to load a background image android: background = "@ drawable / picture" And everywhere on the question of how to make it transparent, they say to put android: alpha = "0.5", so what? it turns out just a bright picture, but not transparent, through it you can not see the elements of the lower activit .. They also say to install color ARGB, where A is responsible for transparency, but it turns out the same Bright picture, not transparent ..

<GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gridview" android:layout_width="fill_parent" android:layout_height="fill_parent" android:columnWidth="70dp" android:numColumns="auto_fit" android:verticalSpacing="3dp" android:horizontalSpacing="3dp" android:stretchMode="columnWidth" android:gravity="center" android:scrollbars="none" android:textFilterEnabled="false" android:touchscreenBlocksFocus="false" android:fastScrollEnabled="false" android:focusable="false" android:background="@drawable/vvv" android:alpha="0.5"> </GridView> 

In the manifest, I do not even know what else to try, until here enter the code here

1 answer 1

To realize that you want to use fragments better (or other options, for example, PopupWindow ).


UPD. And really, you are right. Added style:

 <style name="AppTheme.Transparent" parent="AppTheme"> <item name="android:windowIsTranslucent">true</item> <item name="android:windowBackground">@color/transparent</item> <item name="android:windowNoTitle">true</item> <item name="android:backgroundDimEnabled">false</item> </style> 

In colors.xml

<color name="transparent">#55000000</color> In this case, the result was: enter image description here You can android:alpha="0.5" in the markup to add.

But on the life cycle did not volunteer for onStop the first Activity . Logs:

 E/onPause: onPause E/onCreate2: onCreate2 E/onResume2: onResume2 

When turning the screen:

 E/onPause2: onPause2 E/onStop2: onStop2 E/onDestroy2: onDestroy2 E/onCreate2: onCreate2 E/onResume2: onResume2 E/onStop: onStop E/onDestroy: onDestroy E/onCreate: onCreate E/onResume: onResume E/onPause: onPause 
  • But how so? It is worthwhile to put android: style / Theme.Translucent and from this I see, what lies below (with the STOP or Pause life cycle) but I do not want to be 100 percent transparent .. But still, even on the basis of numerous topics, how to see the one below (which lies lower in the task), we can conclude that this is how it is done. And the fact that I can make the window 100 percent transparent says that it can be done 50 percent transparent. And I do not understand why everyone says that if you put android: alpha = "0.5", then the window will be transparent .. although this is not so - Turalllb
  • @Turalllb, hmm, interesting, gone dig. - VAndrJ
  • @Turalllb, and what will be activated in the background after the screen is rotated? .. I doubt it very much, because in this case you need to recreate it, and the activation from which you left will not be recreated. - Yuriy SPb
  • no need to recreate the bottom activit. the bottom does not touch at all. top activity that is created here <activity android: name = ". MEM" android: label = "@ string / MEM" android: launchMode = "singleTask" android: theme = "@ android: style / Theme.Translucent"> </ activity> And you can even flip the screen, this activity has no background at all, it is transparent. it is necessary to register it in the manifesto. - Turalllb
  • @Turalllb, as they say, live and learn. Thank you for the good question, you need to read the subtleties. - VAndrJ 6:55 pm