How to show ExpandableListView manually if i touch a button. So far, the only way i can open it is by sliding the screen.
I couldn't find any method like show() like on Toast. I've tried looking for any similar sound method on android reference.
I think you can try scrollTo method to scroll to a postion.
For open/ close a group, you can use expand method.
I found the answer. Turns out, i was wrong. I should've animate the container. In this case, the drawer.
I got my answer from here. How to open Drawer Layout only with button?
I just need to call opendrawer().
Related
So I'm following an Android tutorial and came across an issue. The video maker uses setEnabled(false) to hide a TextView until the user clicks a certain button. However, when I tried the same code, the TextView was on the screen before the user clicked the button. I've been trying to work out why for an hour, but to no avail. Below is a link to the video and a picture of my relevant code, XML code, and screen display.
Video: https://www.youtube.com/watch?v=NGRV2qY9ZiU Talks about setEnabled at 16:35
However, when I tried the same code, the TextView was on the screen before the user clicked the button.
setEnabled(false) won't actually hide the TextView. To do that you need to do
result.setVisibility(View.GONE);
When you are ready to make it visible (instead of setEnabled(true)):
result.setVisibility(View.VISIBLE);
try
result.setVisibility(View.GONE);
instead.
Edit:
note that:
result.setVisibility(View.INVISIBLE);
would also hide the view but it would still be clickable.
Use the below method. It will hide the element from the view.
result.setVisibility(View.GONE);
I have a FrameLayout I want to disappear it on a button click and make it reappear on a button click
I tried this to disappear and it worked great
background.setVisibility(View.INVISIBLE);
background.invalidate();
but when I tried to get it back using the below code it didn't work.
background.setVisibility(View.VISIBLE);
background.invalidate();
What is the right way to do this?
check the thread on which you are executing these
just have a look at this example. This may help you!
And I think the method invalidate() invalidates the view (after invisible the view)and so it's not reverting back(invisible to visible).
I don't know how exactly this type of buttons is called that's why I can't even google about it.
You use that button to unlock phone - tap on it and move from left to right.
I'd like to add same button in my app. How to do it?
You should use SeekBar to achieve what you want. http://developer.android.com/reference/android/widget/SeekBar.html
Here is a good example
http://www.techrepublic.com/blog/app-builder/androids-seekbar-your-way/943
Try this for a library
https://github.com/sitepoint-editors/SwipeButtonExample
and this for a DIY
https://rightclicksolutions.wordpress.com/2014/04/09/android-slide-to-unlock-like-ios-mb-slider-slider/
You can overide onTouch() and change the location of the button acording to the x position. and when you lift the finger you can overide onUp() (im not sure thats the name of the method) and create an animation that will lead the button back to its place.
From your question I get that you might think its a button you can simply add from a list of buttons, well, its not. you need to manualy create it.
Can anyone tell me what control or how do you create the pop-up effect used in these images to display the legend?
The screenshots are taken from an app called FlyOKC.
Any help is greatly appreciated, thank you.
This is not exactly a custom dialog. But, yes it is still a customized view. And it is more or less called Quick Action Dialog in android. I would suggest you to follow the tutorials below for generating an exactly same popover (or even better) with Android. Check the screenshot also.
http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
http://www.androidpatterns.com/uap_pattern/quick-actions (Pattern Reference)
That's certainly using a custom version of a dialog. The idea is to implement your layout in a xml and inflate it in a dialog. There's a lot of tutorials around, try that one.
Actually, that can be achieved by using RelativeLayout and switching the legend view's visible state between View.VISIBLE and View.GONE in button's click handler.
To get the exact animation you'll need to jump some hoops.
Here are related threads:
How does one Animate Layout properties of ViewGroups?
How do I animate View.setVisibility(GONE)
Also, I think another (and possibly easier) way would be to use Fragments API with transition effects, in which case this is the thread to read:
Animate the transition between fragments
i have 4 activities in which i have to swipe them right, left and if i am in last activity and swipe to the left then again first activity should be shown.
can anybody have any idea how i can achieve this? or some sample code?
thanks a lot.
you can achieve it by animaton..
But it will show as a Gallery view and you can swipe as well...
OnTouchEvent on every activity you can call another activity using intents by
overridePendingTransition(R.anim.act_back_slide_enter, R.anim.act_back_slide_leave);
//overridePendingTransition("animation for activity which enters", "animation for activity which leaves");
I have not yet tried this... but we can make it in this form.. If you get success let me know.
#sajjoo Here goes your answer in deezapps widget with the questions below pointing at it
How to show multiple screens with right/left slide Gesture
How to create a slider screen (As in Tweetdeck) in Android?
and many more linked questions..
I recently posted a question that covers a lot of this (my question is about using Swipe together with ScrollView, the Swipe gesture by itself works just fine):
Swipe/Fling tab-changing in conjunction with ScrollView?
If you read the sources I have listed and use the code I've provided then you should be able to do it.
It's work fine... just must to delete the redundant R.java file...!
http://www.codeshogun.com/blog/2009/04/16/how-to-implement-swipe-action-in-android/