blue and white AlertDialog in honeycomb - java

I want to create an AlertDialog like this :
I know that a blue and white view like this can be made by writing a custom XML file. My question is that is there a built in theme in Android (like Holo) which can be applied to get this effect.
I want to do it in an application being built for Honeycomb. The screenshot is from an Ice Cream Sandwhich emulator.

I found a solution close to this.
AlertDialog.Builder builder = new AlertDialog.Builder(activity, AlertDialog.THEME_HOLO_LIGHT);
This produces a dialog similar to the one above, except that the title is not in blue color (instead, it is in black color).

Related

How to place comments on a full screen image?

I'm working on a native android application in java with Android Studio and I want to add comments on full screen images like this. This based upon a feature of "Figma" where you can place comments on prototypes.
I have already made a xml file that normally has an Imageview in full screen. So I probably need to draw a circle on the exact coordinates of the view where I click. So how can I achieve this in java code?
Figma example 1
Figma example 2
use draggable view and when user clicks it display dialog where they can enter a comment,
then save the position of the view and the comment to SQLite or wherever you want so the user can retrieve it again whenever they need it

How do I make a button highlighted with a description in an android app?

I'm building an android app and I want to highlight a button on the first use. I have seen exactly what I want in other apps, such as the BBC iPlayer app. As shown in the image, there is a wide black circle around the cast button with a description of what is is.
screenshot from phone
How can I implement something similar in my own app?
Thank you very much for any help in advance.
This library will do the trick, here is how you use it :
In your grade :
implement 'com.github.amlcurran.showcaseview:library:5.4.3'
And in your code :
new ShowcaseView.Builder(this)
.setTarget(new ActionViewTarget(this, ActionViewTarget.Type.HOME))
.setContentTitle("title text")
.setContentText("some text")
.hideOnTouchOutside()
.build();

Custom ActionMode in AlertDialog

I spent a few hours to get the same look of ActionMode during selecting text inside Dialog as in eg Fragment. If I select text in Fragment, ActionMode, it looks like it is from from Lollipop if in Dialog like on 4.3.
What is most annoying is that sometimes it is showing normal icons (grey) but sometimes they are white so you don't know what you can click. I don't have more ideas, I tried everything I found:
Custom style of: actionModeStyle
Specified in main style: actionModeBackground (doesn't work any of other options too)
Custom ActionMode.Callback (this one works but is showing under default ActionMode)
Changed theme of context passed to AlertDialog.Builder working but its not same as in eg fragment.
App compiled with API21, target 21, tested on SGS3. Compiling with API20 doesn't change anything, so I don't know how it is possible that ActionMode changed look to new design. S3 works on stock system 4.3.
Screenshots
In fragment
Dialog - with white icons, sometimes they are grey
Dialog - with themedContext passed to Builder
Is it possible to get the same look inside Dialog as is normal in Fragment? Or everywhere as in Dialog? Before one of the last updates I always had ActionMode as on 2nd image, but showing correctly.

Transparent Status Bar Android 4.3

In the 'new' Android Version 4.3 there is a new feature. The status Bar on the top of the screen is transparent in the launcher (I'm using Samsung TouchWiz on Galaxy S3) and in some other Apps too I think (looks a little bit like the iOS 7 style).
Can you tell me how I can make the Status Bar transparent (or colored) in my own App (Eclipse, Java)?
Theme.Holo.NoActionBar.TranslucentDecor
Theme.Holo.Light.NoActionBar.TranslucentDecor
Based on the best answer here: How to make the navigation bar transparent
I'm not sure about the transparency but as of API 10 you can set a background drawable for the actionBar. (and thus a color)
In the following codesnippet I get a color based on an attribute (depending on the theme chosen)
TypedArray a = getTheme().obtainStyledAttributes(new int[]{R.attr.background_activity_color});
actionBar.setBackgroundDrawable(a.getDrawable(0));

Android Spinner - How to make dropdown view transparent?

I have a custom spinner dropdown xml file in /res/layout/:
spinner_view_dropdown.xml:
<?xml version="1.0" encoding="UTF-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/spinner_item_dropdown"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#android:color/transparent"
style="#style/spinner_item_dropdown" />
I'm setting the spinner dropdown via java:
// "Spinner", aka breadcrumbs
Spinner spin = (Spinner) findViewById(R.id.breadcrumb_dropdown);
ArrayAdapter adapter = ArrayAdapter.createFromResource(this, R.array.breadcrumb, R.layout.spinner_view);
adapter.setDropDownViewResource(R.layout.spinner_view_dropdown);
spin.setAdapter(adapter);
// /"Spinner"
Unfortunately, a white background still exists on the spinner popup regardless if I set the background to transparent.
How do I fix this?
You can override the style for the dropdown, and the dropdown item by using a Theme in your app that inherits from one of the Android themes, then override the
android:dropDownSpinnerStyle, or android:spinnerDropDownItemStyle, and even the android:dropDownListViewStyle attribute of the theme, pointing to your own custom style instead of the Android style that is defined in their theme. I created a fully customized spinner this way, with a transparent button AND dropdown. I even got rid of the dropdown list dividers, and set my own spacing for the dropdown items when I built the tablet app for Fandango (take a look at the sort movies spinner on the main page of the app).
Everything in Android is customizable, you just have to know where to look. ;-)
Try setting on the spinner this:
android:popupBackground="#android:color/transparent"
The layout you're defining is only used for an entry of your drop-down, not the drop-down itself. So setting the background to transparent won't have any effect on its background. But even if it would, setting the background to transparent would still have no effect, because a TextView (actually I believe any view) has a transparent background by default.
That being said, the right question would be: can you provide a custom layout for an entry's parent view (which is probably a List)? As far as I know, the answer is no, unfortunately.
Try
android:cacheColorHint="#00000000"
to get transparency.
I dont know if it works for you but there is a post
http://android-developers.blogspot.com/2009/01/why-is-my-list-black-android.html
that explains why the moving parts of a list appear in the background color.
Maybe its the same issue with your spinner.
It's a bug in 1.5 I think, see here
http://www.symsource.com/index.php?view=article&id=418&option=com_content&format=pdf
Run it in a 1.6 emulator or device, does it still stay white?
I actually came here looking for an approach to this, I suspect this may involve manually writing to the canvas or something like that.
Any ideas.
P.S. Accidentally posted when I thought I was logged in, anyone know how to get rid of the anonymous comment? Maybe an admin could fix this?

Categories