How to customize the SearchDialog in android - java

When SearchDialog is called, it have a white background.
There's a way to change the background color, and also remove the up button with the icon near to it?
I don't use the SearchView, i use the search dialog because i need it also in android pre 3.0
Thanks

Related

How to set Action bar sherlock color permenent through java?

I want to change the ActionBarSherlock color permanently, I tried the following code but, when I reopen the application it resets to the previous color
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color));
My intentions are to make a theme that changes the ActionBarSherlock color with user input
First of all, stop using ActionBarSherlock. Use the AppCompat library provided by Android.
Secondly use ActionBar Style Generator to apply style (color) to the ActionBar

ActionBarSherlock custom NavigationDrawer icon

I'm implementing NavigationDrawer with ActionBarSherlock and now I'm trying to implement custom icon for opening and closing the drawer. I already set my own icon (white) but I'm not able to get rid of that grey default icon.
in onCreateOptionsMenu I'm doing this:
getSupportActionBar().setDisplayShowTitleEnabled(false); // does not display activity title
getSupportActionBar().setBackgroundDrawable(
getResources().getDrawable(R.drawable.actionbar_background)); // blue background
getSupportActionBar().setIcon(R.drawable.side_menu_button); // white icon
The picture shows difference when navigation drawer is closed (first) and open (second picture).
Is there any way to do it programmatically? Or is there even some way to do it? I hope it is.
Thank you.
EDIT: This is what I'm trying to achieve:
What you are currently doing is setting the icon on the ActionBar, which is different from setting the icon of the ActionBarDrawerToggle, which is what you want to be dealing with. If you look at the documentation (http://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.html) and find the constructor, you'll see there's a place to specify a custom Drawable to be used by the toggle.

Why does my android emulator have different background than main.xml ?

So, I have a holo light theme, I am developing for android 3.0 and in my main.xml graphical layout shows a black screen which is what i want, but when I run the app on my android emulator version 3.0, it has a white background.
I want to have a black background, but main.xml layout shows me black background only the emulator shows different, why ????
Thanks, I have been developing for a week, but it's quite annoying. Thanks !!
The key is to customize Android Graphical XML Editor(Lets call it AGXE) properly to match the exact outcome of your program. For this purpose there are several ways of customizations are available.
In your case you are using Holo.Light the for your application, in your AGXE theme customization(in the light blue highlight) might be Holo/Theme.Holo (or something else) which has a black appearance for blank space.
If you want to know how your app layout will look in Holo.Light theme you have to manually set your theme to Holo.Light/Theme.Holo.Light
There are other controls in the AGXE, which can be used to get the most accurate representation of your layout in real life/emulator you specified (highlighted)(If you want explanations for each ask in comments below).
If you want to set a black background as Theme.Holo, you just have to put a single line code in all your layout android:background="#000000" which will set your entire background as black instead of white (even in Theme.Holo.Light), or you can specify your theme as Theme.Holo.
Read more here

Change app background

I'm currently making an android app in which I'd like the user to be able to change the background image.
I've got 3 images and a screen where I can choose a picture and a button for applying.
The issue:
I can allow the user to see all images in the way I want, but I don't know how to set the selected image as app background.
What I want to do:
I want the user to click a button, which exports the selected image to "bakgrund.png" in "/res/drawable-mdpi" and replaces the current one. This would allow me to easily integrate the background switcher. Renaming of current files also works.
PS: My current background images are located in /res/drawable-mdpi named 1.png 2.png and 3.png.
Easiest way would be to call the setBackgroundResource(image_id) method on the root layout. Like if you have a LinearLayout which has android:id="#+linear" as the root layout in the layout xml, then this code will help:-
LinearLayout linearLayout=(LinearLayout) findViewById(R.id.linear);
linear.setBackgroundResource(R.drawable.1);//call this in the OnClickListener's OnClick Method
Firstly, you need different themes which has different backgrounds. So you may use this.setTheme method in your Activity.
Indeed I suggest you, two different layout (with different backgrounds but have same components) and using setContentView during onClick.
I hope it solves your issue.

Android Dropdown Effect - Spinner or not?

Achieving a true "dropdown" effect (as seen in Adobe's Photoshop Mobile app for Android, image below) has proven challenging using Androids built-in methods.
As others on Stackoverflow have told me, editing the style of a dropdown list view of an Android spinner is limiting.
How is this dropdown effect done?
(I can't seem to get an image to show, so here's a link: Adobe Photoshop Mobile for Android
After viewing the Adobe slideshow I think the way I would attempt to get that to work, using the Android Java SDK, would be to create a ListView object with a transparent background, and then dynamically hide/show it in that position when the menu button is clicked by setting the View's visibility to VISIBLE or GONE.
Getting a ListView to be transparent shouldn't be that difficult. I'd look into AbsoluteLayout to get it to hover over everything in that spot.
Another option might be to display the ListView in a custom Dialog that you've written, again positioning it in that exact spot on the screen so that it looks like a menu extending from the button that was clicked.
It's probably done using low-level draw functions.

Categories

Resources