I have two TextView in my android code, one over other. The lower text view do not have onCLickListener set but the other TextView has, and also lower TextView is set invisible. The problem is that the upper text view do not respond on click as long as it is placed over the other text view. Please tell how can I solve this issue? I can not change components' positioning because of some reasons.
Seems like a z-index problem to me: your invisible view is placed on top of the visible one, which does not receive the click.
The click is received by the invisible one, that does nothing.
I've never experienced that, but you could try to define the visible view after the invisible in your xml file.
If it does not work, I believe that here can be something that could help you.
Make sure that the textview is gone not just invisible:
Eg.
textview.setVisibility(View.GONE).
This will make the textview leave instead of just making it invisible.
Apply following line on desired TextView and then check onClick event.
yourTextView.bringToFront();
Related
I want to get result image pragmatically.
When the user submitted answer the view "Option" text should automatically set on top of the screen in ScrollView. The whole view is inside the ScrollView.
You might have the "Option" TextView inside the ScrollView with a visibility set to gone in your layout XML file. When an answer is selected, change the visibility status of that TextView to View.VISIBLE programmatically.
Hope that is clear. Please let me know if you need to anything else.
i'm having the next problem.
I have two layouts, one behind the other. When I click on the first view the "click" pass trough the view and it arrives at the second one. How can i stop the onclick only for the first view and enable it when i want at the second view?
Thanks in advance.
EDIT
A image with my problem
2EDIT
Why am i doing this? Because i put im my app a menu like facebook. So i have the menu in the red view and i animate the green to the right to see the complete menu. See http://venturebeat.com/2011/12/07/facebook-for-android-upgraded-with-better-navigation-faster-photo-views/. Seems that the solutions is with set the view clickable to false.
It's not clear what and how do you want to achieve, but it doesn't seem to be a good idea to have RelativeLayouts on top of each other. For this you could use a FrameLayout, or if your layout is a bit more complicated, you could play with setting the views unclickable.
If this doesn't help you, please post some code.
EDIT
It's still not too clear why do you want to achieve this, but you can set the second view unclickable, whenever you want.
I need some help, i want the android scrollview animation effect....
Basically when the someone click on the textview of linearlayout in scrollview another horizontal view should come in.
Here is the pic....
What you could do is setup ontouch() on the textview. once you touch it then you would make the layout visible with setVisiblity(). you could even add in a animation to make it more professional.
You would probably get a bug if you didnt make every other view GONE, when you touch a new textview.
I like this idea and I might work around with it myself!
Good Luck
I'm developing a list view in which each cell is a LinearLayout with other views inside it. I have also set the onClickListener of the cells to take the user to another Activity.
The problem is that one of the views inside is a TextView in which I apply the Linkify function. When the TextView happens to have a link in its text, I cannot trigger the onClickListener anymore, unless I click on another view of the LinearLayout. This problem also applies to the highlighting feature.
Does anyone knows what may be happening?
Thanks!
If you are applying the Linkify function inside of your getView() Override, I would wonder if it's just automatically setting the "Clickable" type methods on the view being passed to it. Right after Linkify, you could try calling setClickable(false), setFocusable(false), setFocusableInTouchMode(false) all on the view that was Linkified.
I have a UI that has a handful of text entries that might be needed by the user. The users selects the type of entry from a spinner. when the selection is made I change the visibility of some edittext controls and change the label that goes with it.
The problem is the space where the edittext was is now blank and the screen layout looks screwy.
I put all of this in a table, hoping I could hide a row, but that didnt help either.
Any ideas short of make a new class for each one?
Instead of setting the visibility to View.HIDDEN, set it to View.GONE. From the description for View.GONE:
This view is invisible, and it doesn't
take any space for layout purposes.
Use with setVisibility(int).
just make sure u use SetVisibility(View.GONE)