I want to create a TAB-like activity.
The regular tab host has a specific design.
I want the tab buttons to be image views without any BG.
And by clicking on the image will just change the tab the regular way?
Maybe there is a way to do it in the regular TAB host?
I will be more specfici - the 2 buttons are actually 2 image views (also has 1 png for selected and 1 png for unselected). These 2 images are on the main BG (unlike the UI of the TAB Host). Upper to them there is the area (e.g. Frame) where my 2 activites should be ... Both activities has listview in it.
Check these:
Custom Android Tabs
Customize Android TabHost TabWidget
yes . you can do it . create yourView.xml and set this to TabSpec.setIndicator(View)
A simple solution will be to create 2 separate views for the 2 tabs, then depending on which button (Tab1 or Tab2) is clicked, make the corresponding view visible and the other gone.
And of course you can give whatever background image to the buttons you want.
Related
I have some parts of the screen that stay permanent and one part of the screen which is a container that should change its content to one of a set of Card elements, according to a button press on a button group.
If I understand correctly I cannot use the Tab-Navigator (or the Stack-Navigator) because those control a full page (i.e. screen) change, and I only want to swap a single card element.
Am I correct about that?
If so what do I need to do? Is there some existing UI element for this? If nothing exists, how would I go about doing this? Each card loads different stuff from a local json, and I don't want to reload them when switching back and forth...
I want it to have the effect shown in Android UI (non react-native) samples: android Navigation Tabs in middle of screen
Perhaps I should be using swiper like in this answer? implement tabs in the center of the screen .
You can use a tab navigator, think about a structure like the one below
<View>
<OtherStuffThatFilLTheScreen>
<TabNavigator>
<OtherRandomStuff>
<View>
Tab navigator will have full control of the element that renders inside its space, but will not change other elements outside its scope
i have footer layout contains 4 button. footer display in all my activities like
now i have 2 questions:
as image shows when click on any button then color of button image and the background will be change
how to access footer button from activities,i don't want to do copy paste the same code in all activities.is there another way to do this.
how to do this 2 things
For 1.
to change the color of the icon:
buttonView.setColorFilter(ContextCompat.getColor(YourActivity.this, R.color.yourColor1));
to change the background color:
buttonView.setBackgroundTint(ContextCompat.getColor(YourActivity.this, R.color.yourColor2));
For 2:
You could implement a basic Activity, where you put your code to handle the footer access. Then you derive all your activities from that basic activity
If you need further instructions for 2. write comment
Is it possible display one tab or another in android dynamically?
I am trying to make an app with 3 tabs but sometimes is possible that one or two tabs will not have content (not buttons or data in activities) so I want just show the activity which has data or one of both with it.
I want to keep the possibility that the user navigate to tabs without content but I want to show firstly the tab with it.
I am following this tutorial: http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/ to do the tabs. I mean, if you need my code to make any modification or add anything. For the moment I just want to have an example to show it and after that start adding my code, which already works in an older app.
You can move to the tab by using
viewPager.setCurrentItem(item_position);
getActionBar().setSelectedNavigationItem(item_position);
I'm trying to design an application where the main mode of navigation through the application's several primary screens uses Tabs. I've basically copied the approach shown in the tutorial here: http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/
However, on some of these screens there are clickable elements that are supposed to kick off a full-screen page (the tabs should no longer at the top of the page). I've been able to get this working by creating a new activity for the new screen, but I believe I want to use a fragment for the new screen because in a tablet layout, I want the new screen to appear beside the main screen rather than replacing it. I haven't been successful doing this. If anyone can give examples or pointers on how to get a single activity to run fragments with tab-based navigation and other fragments that that don't have the tab navigation.
In a similar vein, I also have a settings screen accessible from the Options Menu. Are settings screens like this typically done as activities or fragments?
Thanks in advance.
You have to design your application in two ways.
Firstly you should know if you are running big device (tablet) or smaller one (smartphone).
You could make that by preparing two different layouts, one layout in layouts resource folder for smartphone and second layout in layout-xlarge resource folder for bigger devices.
In smaller layout make only one container for one fragment (list fragment for example). In bigger layout in layout-xlarge folder you coul have two containers one for fragment with list and second for fragment with content.
In onCreate method you could see if you are using multi pane layout or not.
If your secod pane in bigger layout is for example R.id.right_panel. You just make findViewById(R.id.right_panel) and if this is null, you know that you are not running multi pane.
Now if you are in multi pane, pressing item on the list should notify activity, and activity should change/replace right fragment with another one.
If you are not in multi pane, pressing item on the list should open new activity with only one fragment of content.
There are many tutorials of this of simmilar solutions like link or link
Regards
Like on the following screen. It looks less than standard size. And without vertical lines between icons.
This is most likely not a tab control at all. You can simply use Buttons or even better styled RadioButtons for pseudo tabs and then use ViewFlipper to display sequence of cards based on which button was clicked