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
Related
I'm a beginner with short knowledge of programming, I've just started learning android development. I'm making an app and at one of the pages I have to make a certain kind of design that I cannot figure out how to or can't even find them in the internet. Basically, as you can see in the images below, next to the first textview, there's a little arrow. Whenever the user clicks on that arrow, two edittexts should appear below that texview just like in the second image and kind of drag the rest of the textviews down. I'd be really grateful if you guys could help me do this or at least provide me with some information on where to search this kind of problem solution. Thanks.
Just create your desired layout in xml with 2 edittext below each textview. But make sure You take these 2 edittexts in a single container. Lets say LinearLayout.
Then you would be easily able to show/hide these lineralayout based on the TextView click.
Or If You are using recyclerView, then it would be more easy. In this case, You have to show the 2 edittexts for currently clicked item only and will need to hide for all others
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
i have to create two layers and switch between them by clicking buttons. for example it should be approximately like this
can anyone tel me where and how to start. i dont have any idea about this.. i want an idea about this
thanks..
You can create two different layout with different id. Then to select the second layout set first layout visibility gone and to select first layout make second layout gone and first layout visible.
youViewLayout.setVisibility(View.GONE);
I'm just writing my first android app and in one layout xml file I have four buttons that will display a different layout when pressed. Instead of creating four seperate screens, I've just put the four layouts in the same layout as the buttons with android:visibility="GONE", and then when a button is pressed, I set it's corresponding layout to being visible.
My question is, is there a best practice or suggested method for keeping track of the active layout so that when a button is pressed you can set the active layout back to visibility="GONE" before making the new one visible. I thought I could just set a string value with the ID of the active layout, but then findViewById wont take the string to get a hold of the layout. Any help or suggestions would be great. Thanks!
Why do you use a string to save the ID of the layout? Can you not just use an int since the ID's are such? Or set the visibility of the layouts from the onClickListener you attached to each button?
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.