popup screen with background not in focus in android - java

I am trying to design something like the image below
I have tired PopupWindow but the background still remain in focus.

Create Custom Theme in style like this
<style name="CustomDialogTheme" parent="android:Theme.Dialog">
<item name="android:backgroundDimEnabled">true</item></style>
and call this on Dialog you want.

Related

Fixed background while switching layouts

I got my application uploaded and I see that despite I have the same background image on all my layouts.
if I switch, the layout moves according to the animation.
Is there a way for me to set a fixed background for all my layouts?
Does it matter that I finish(); every layout before I switch to the next one?
Setting the same background to all the layouts doesn't make it fixed (it moves)
neither does creating a style like :
<style name="AppTheme.FullBackground" parent="AppTheme">
<item name="android:background">#mipmap/background</item>
</style>
and adding :
android:theme="#style/AppTheme.FullBackground"
to the manifest.
Any ideas?
If you are using all activities in your app then change all activities to fragment and just use one activity with your required image as background.
Then use just this activity for all the fragments in your app. This will not move your background image during navigating to different screens(fragments)

Android (eclipse) image button vs background image

I'm trying to figure out which is best to use.
I'm trying to develop a simple game and designing the starting activity. to start the game I plan to have a start button.
I want to use a custom design though.
My question is, should I use an ImageButton (which I believe is an imported image that you can click on, or a textview with android:background="#drawable/imageName".
Both seem to allow onClick if I'm not mistaken so what's the pros and or one over the other?
Hope this isn't duplicate question, all I found was info on how to upload images which I don't need. Just need to know advantages to using one versus the other.
also, Does onclick for textview apply to background or only text?
I think imagebutton maybe better.
because you must have a click effect for feedback . if you use background for the image ,you have to write a selector.xml for change the click and unclick effects.
so, i think imagebutton may be better.
You can use android:src="#drawable/imageName"
So that the image will be perfect fit. Also you can use
android:scaleType="fitCenter"
android:adjustViewBounds="true"
If you are using TextView then your background may not be good
From : Difference between a clickable ImageView and ImageButton
There's no differences, except default style. ImageButton has a non-null background by default.
Also, ImageButton.onSetAlpha() method always returns false, scaleType is set to center and it's always inflated as focusable.
Here's ImageButton's default style:
<style name="Widget.ImageButton">
<item name="android:focusable">true</item>
<item name="android:clickable">true</item>
<item name="android:scaleType">center</item>
<item name="android:background">#android:drawable/btn_default</item>
</style>

Implement a bar with some buttons in android

I'm having some difficulties to reach a way of implementing an layout that i want for a android project. I have to make a layout like this:
This bar is at the top of the android screen over a map of google and each icon are a button. The map is already in the layout at this time.
Whats the simple way of doing this with android layout?
After that and not so important at this time, after click each button i have to open a rectangle with some options to fill (text boxs and dropdown lists) but i know that i can do this with a alert dialog. Is this the best way for doing this part?
Regards for the help
you can use third party libraries for this. ActionBarSherlock is the library which you can use.
Here's a link Click here to download
and for tutorial follow this link.
thanks
You can use an Action Bar, and overlay it on top of the map.
To enable overlay mode of the action bar, you have to create a custom theme and modify some values:
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActionBarTheme"
parent="#android:style/Theme.Holo">
<item name="android:windowActionBarOverlay">true</item>
</style>
</resources>
More information on this in this android documentation

Creating bodyless activity

Currently I am trying to make an activity that can be moved on the screen , in other words this activity can float on the screen. I know I am missing something that should be added to achieve this functionality.
What should I do to achieve floating activity which can be moved around anywhere on the screen?
If you're looking to do something similar to the Facebook chat circles (where you have a view on top of other apps) then take a look here: http://www.cloudinfy.com/2013/06/android-chat-head-view-like-in-facebook.html
Basically you need to start a service and add a view to the window manager.
If you're looking to simply create an activity to look like a dialog then have a look here: Android Activity as a dialog
This is very similar to a normal activity but the theme is set to Theme.Dialog
There's a good solution here: http://cases.azoft.com/android-tutorial-floating-activity/
They just add an attribute to the theme of a tablet Activity:
<item name="android:windowIsTranslucent">true</item>
If any problems on KitKat devices, add some lines to the theme:
<item name="android:windowIsFloating">true</item>
<item name="android:windowCloseOnTouchOutside">false</item>
<item name="android:colorBackgroundCacheHint">#null</item>
<item name="android:backgroundDimEnabled">true</item>

How to change the background colour of the spinner on the aciton bar

I'm working on an android app and have come across an issue, I have managed to get the list items on the action bar to highlight to the color i want but the 'spinner' area around the item is staying the default blue, does anyone know how i can change this color?
I've fixed it!
I used this website which allows you set colors etc. for your action bar and then you just put them in your drawables folder and link it up with the style sheet.
I'm not sure if its the cleanest fix but it works.
http://jgilfelt.github.io/android-actionbarstylegenerator/
Try using android:background within your spinner.
Try this:
(without Sherlok)
<style name="Theme.MyTheme" parent="#style/YourTheme">
<item name="android:selectableItemBackground">#drawable/ab_selector</item>
<item name="android:actionBarWidgetTheme">#style/WidgetStyle</item>
</style>
<style name="WidgetStyle" parent="Widget">
<item name="android:itemBackground">#drawable/ab_menu_selector</item>
</style>

Categories