If this has already been asked, forgive me. But I'm wondering if there is a simple way to adjust the transparency for ListView selection. I know how to change the color, but is there any attribute that allows to adjust the transparency? Or would you have to upload some custom background?
If by transparent you mean see-through, and by ListView selection you mean a single item of the ListView, then its called alpha. The link should show you the info for the XML, but you can also set it using setAlpha(), which is accessible to any View.
Related
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
I'm making an app that works as follows:
when you click a button, there will appear an EditText and a Button and a TextView.
I have already done that, but the style is not the same as the style when I create the EditText in xml (it looks different, the colour is not the same).
There will always be a couple of EditTexts, so the user will see the difference very well.
I also prefer the colour of the EditText when I create it in xml.
How can I change the style of an EditText programmatically?
Thanks in advance!
http://i.stack.imgur.com/24dzI.png (picture from the difference)
The issue here is that the background is being set differently between the two fields. You can just use setBackground(...) to have it match the other fields.
If you need to get the proper background drawable, look up one of the existing fields, grab the background from there, and assign it to your dynamic field.
http://developer.android.com/reference/android/widget/EditText.html
You can use EditText.setTypeFace() or EditText.setTextAppearance(), depending on what you're trying to change. The link has all the methods that EditText can perform.
I set a picture as background in my main activity with some objects like home.gif, car.gif, dog.gif, etc. All object files are transparent.
I want to highlight this objects that user can interact with it.
I could not found examples in web how to get this effect. So I am asking here.
I would be grateful if you could help me.
Thank you for your time and consideration!
Ciao, Szymon
You want to show the border of the transparent images in an activity?
Then in selector of that view you just add a pressed state which has borders set.
Is it possible to use the VideoVideo with the ListView as an item. Has anyone done this? Are there any issues I should be aware of?
I've made a test.Videoview can be inserted into a listview, it can work properly.But when i drag the list, the area which the videoview once occupied will get in front of the screen. Andt the screen will get very dirty.
Is it possible to use the VideoVideo with the ListView as an item.
I doubt it. SurfaceView -- which VideoView uses -- does not behave much like a normal widget. IIRC, you cannot have two SurfaceView widgets active at the same time, regardless of what contains them.
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?