I struck in Materiel Design and need to connect those two button like the image mentioned below and when i clicked the any one button only the layout should change not the activity, so I googled for this solution but i didn't found any.Could anyone suggest me some possible solutions to achieve this UI.
You want to keep the 2 buttons and a line in buttons as well if that is the case.
Use 2 buttons widgets and keep a view between them as for lining purpose. And fro your question one button only the layout should change not the activity
You can try fragments. On clicking any of the buttons change fragment
you are suppose to use Fragment with viewpager!
you just disable viewpager swipe by this mViewPager.setPagingEnabled(false);
and setSelection when clicked on item
here is a cool library to implement this.Step view
Related
Good morning people,
I am making an app and to the following problem !
Have an activity that has a LinearLayout and inside it has 3 buttons , I wanted to click on certain button , these three buttons vanished and within that LinearLayout enter another , with textview , other buttons and all, but when you click the button back android , back before the three buttons , all this without changing the top of the page , trying to do with Fragments , but to no avail ...
Trying to manage this through visibility of different layout elements (i.e. LinearLayout) can lead to serviceability issue in the long term.
Fragments would be one of the better ways to implement this.
I personally have found the following tutorial about Fragment helpful as an introduction:
http://www.vogella.com/tutorials/AndroidFragments/article.html
I need to show/hide four textviews on pressing four buttons. The functionality is visible in pictures. In iOS I used button. But for android,can I use some sort of list view or something else suitable to thisenter image description here?
!First and second buttons are pressed here while third and fourth are not yet. Again pressing the button that is already pressed,text hides]1
You can use ExpandableListView.
Using ExpandableListView, you can have groups and childs, and you can expand and collapse any groups you want.
For example:
mExpandableListView.expandGroup(groupPosition);
mExpandableListView.collapseGroup(groupPosition);
These is a very good example on Custom ExpandibleList in Github.
https://github.com/tjerkw/Android-SlideExpandableListView
Hope this will help you to achieve smooth animation and collapse.
You need to change the layout as your requirement.
Hope this will help you.
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've now got the listview and it's touch actions and swipe actions working. But now i'm not sure how i can implement a swipe effect, like it's in the twitter app.
I've found in the internet that it's possible to animate 2 views with a viewflipper, but is it possible to animate two layouts in the same way?
Anyone out there, who knows how i can implement such a function?
The only thing i want is to switch the ListViewsItem layout with a swipe.
Simple, set both the item views in 2 separate thread and then start both of them.
just wondering if anyone else has a better suggestion that what I'm coming up with.
The issue is to do with a TabLayout, 5 Tabs all using a single Activity. Each Tab layout contains quite a few fields so the main parent on each tab is a ScrollView.
What I currently have is a 'Save' & 'Cancel' button sitting outside the scrollviews so theyre always visible and there for the user regardless which tab they're on. The problem is that since I'm using Tabs and always have these buttons visible when they are editing and the IME is displayed, they'res barely any of the form visible.
So I think the best thing for me to do is to probably show the buttons at the end of each scrollview. What I don't like about this is as I have 5 tabs, it will mean I have to declare 5 sets of the buttons, and of course define them and bind them in the Activity.. which seems rather messy and inefficient.
So if anyone has any better ideas I sure would love to hear them :-)
Thanks
Rgds,
Dave
Some of the options you got is
Try to put a title bar, and move the save and cancel buttons there (Small image buttons).
Save can be moved to the menu too (not recommended).
Auto Save functionality can also help, depends on how useful is it to you.
Try to use custom images for tabs, and make it take less space.
else, remove the save and cancel buttons, after the user makes any modifications, and presses back, prompt him to save the unsaved changes.
You could make it that when you're in tab X, the tab button for tab X now becomes X(save), so if they click again on the tab button in the same tab, it saves. That saves you five buttons, potentially...
Define programmatically the buttons inside a LinearLayout and add them to each ScrollView with addView. The code of the buttons should check in what tab are we at that moment, and act accordingly.
Then you'll have the same two buttons arranged in the same way in all your ScrollViews.
Or, if you dislike doing it programmatically, do a layout for the buttons and use View.inflate of that layout, and add them via addView to the ScrollView.