I have following problem:
I want to create a toolbar, with general setting for device (TV) by adding view to window manager. My toolbar is visible in the bottom of screen and it is an overlay on currently selected application. It has following parameters/flags:
WindowManager.LayoutParams.TYPE_SYSTEM_ALERT
-WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH
-WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
-WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
-PixelFormat.TRANSLUCENT
When I click on the toolbar it is working fine.
When I click on the background, toolbar is still at foreground, and background application is working fine.
The problem starts, when I am populating ListView from my toolbar. With those parameters, onClick and onSelectItem listeners are not working on that ListView. When I remove FLAG_NOT_FOCUSABLE, listeners start to work, but I cannot use background application any more. I have to close my toolbar in order to get focus on the background.
Do you have any idea, how to make both ListView and background application responsiveness?
Thanks in advance, for every answer/
This is known issue with PixelFormat.TRANSLUCENT, try PixelFormat.TRANSPARENT
Related
I have android listview with custom adapter.I have implemented the AdapterView.OnItemClickListener . Onclick it launches a new fragment. Now all of that works, but the listview Item turns grey after click in the background.I need it to be transparent/white.
So I thought it must be in a selected state which I somehow have to disable.
This is what I have tried so far without any luck.
listview.setSelector(android.R.color.transparent);
listView.setFocusable(false);
listView.setActivated(false);
Other options such as
in onItemClick(){
view.setBackgroundColor(ContextCompat.getColor(getContext(),
android.R.color.transparent));
interesting this seems to be semi working as if I use color.red. I can see it getting red momentarily before the fragment dialog shows at that point I can see it turning grey again in the background.
Also the odd part is that this last piece of code i.e
view.setBackgroundColor(ContextCompat.getColor(getContext(),
android.R.color.transparent)
works in onItemLongPress. And it stays transparent as expected.
So I need my app that has a switch, which when turned on, should create a FAB. This should then run like a background service, over all other apps, after the main activity/app is closed. So anywhere I touch the FAB, it should be clickable,moveable and should draw over all apps.
Have a look at the following projects
https://github.com/JustinScott/AppFloater
https://github.com/vickychijwani/BubbleNote
https://github.com/sezeryesiltas/chat-head-demo
https://github.com/callmekarthik/FBChatHeadExample
You need to have an activity with transparent windows background set in theme, no status bar, no toolbar, no layout, just the FAB. You cannot bind the FAB to your background service. A service does not have a GUI. You need to have a running activity while your button is showing.
I'd been trying to maintain consistency in layout whether keyboard is open or not. These issue is generated in FULLSCREEN Mode (hiding top notification bar) only. It works like a charm without Fullscreen.
Tried:
Added android:softWindowMode="adjustResize" and android:softWindowMode="adjustPan"inside <activity> of Manifest File.
Added android:isScrollableContainer="false" inside by top layout with blue background having first, next,prev,last symbol.
Desired Layout:
Top Layout Blue Background should never get hide whether keyboard is open or not.
These issue get resolved with ActionBar but it requires a lot of turn work which I don't intent to.
.
Is there any way other than ActionBar which resolve my issue?
Try to create a fixed header layout for the blue back ground layout, and below this blue layout create a layout for other fields inside the ScrollView ...so that when keyboard appeared it will not hide the header blue layout...
This question already has answers here:
Actionbar background is not being changed
(2 answers)
Closed 8 years ago.
In my application, I am using actionbarsherlock. I use
getSupportActionBar().setBackgroundDrwable(R.drawable.test).
It works fine, the color is showed as expected, however when I go to another activity and go back to the main activity. The bar color is changed to black (in my program, I dont set black for the backgrounddrawble and just call setSupportAction().setBackgroundDrawable in onStart()). However, if I change the code to
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(0xff550000)));
The app works fine. When I click on back button, the color is set to 0xff55000 which is expected.
I will suggest not to use the color code directly this way while you are trying to set the color programmatically. It will not take it. just try out this way..
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(mContext.getResources().getColor(Color.BLACK)));
Hope it will work for you.
It doesn't work well for me either, specially if I use with the navigation drawer toggle list. In my case, if i don't use the toggle, the background goes white during a second and then load the background drawable. If I use the toggle, the background remains white.
I had to use a custom view to achive the effect I wanted to get instead of changing the background.
I have almost the same issue, it happens that calling getActionBar().setBackgroundDrawable twice does not work.
If I only call it only once in the onCreate is works. If I put the code in the onResume, it works for the first onResume, but it is set to grey for any other onResume
Why does my Android Listview turn from transparent to opaque when I click it and how can I change that ? The Listview has a background and transparent elements and they scroll and work perfectly, except when I click it. When I click it the clicked element turns opaque and the background is no longer visible.
How can I change the behaviour so that the opacity does not change when I click elements ?
Edit: Could the focus highlight be responsible for this ? How can I disable that ?
Edit: Android 2.3.4, Tegra 2 device, Bitmaps created with Config.ARGB_8888 parameter.
It was the focus as I suspected. It killed the transparency because the focus color is not transparent.
I removed that effect with:
android:listSelector="#00000000"
Add android:cacheColorHint="#0000" to the list view in the xml