I'm new in android development and I'll appreciate any help for implementing the following thing.
I have TabHost and in one of the tabs I want to place some-kind of table. Clicking on one of the rows will slide this table to the left and instead of it it will show the view that corresponding to the selected row and a back button at the top. All this should happen in the same tab. Here is picture of what I'm trying to do.
My questions are:
What element I should use for building such kind of table?
How to implement such slides and back button?
Here is a tutorial on view transitions. - http://www.inter-fuser.com/2009/07/android-transistions-slide-in-and-slide.html
I would think this would be a great place to start. :0)
It's a table no doubt. Read about ViewFlipper. You just need a ViewFlipper parent inside your first tab.
Related
Now I’m designing the UI for my first Android Application. I just wanted to confirm if what I grasped and design choice is rightly done.
The requirement is, I need to display a list of Images+Data on the home page, it might run into hundreds. It also contains a search header. + category selection on thetop.
Clicking on the menu button must side the panel of links for Menu/Config.
I learnt, doing nested layouts are closer to evil in Android. So I did not put multiple one into the other. I’ve put a simplified one.
I have shared what I’ve designed for this requirement. Any word of concern/recommendation would be highly appreciated.
SlidingPaneLayout is the root element of MainActivity.
Bottom View contains list of menus
Top view diplays list of Images
Top view has the following elements
Title Layout : which is basically a RelativeLayout, holds Title name, burger icon and search button
Image ListView : displays list of images from local memory
Sub Category Layout : which is again a RelativeLayout. This displays the sub-category of the image displayed in the Image listview. This will change when user scrolls. Taping on this will display a sub-category listview.
Search bar Layout : which is a RelativeLayout. This has a drop down suggestion listview, which displays suggestions.
Key Questions
Should search be put in a separate activity?
Should search be put in a separate View/Fragment?
Is there any way the layouts can be reduced or replaced with better layout?
1-2/ The ListView should be put in a separate fragment and the search should have its own also. The search view fragment should be open on press of the search icon. You have listeners for opening and collapsing the search field. The idea is to change fragment only in the host activity. Each fragment should implement its own logic.
3/ For sure don't use ListView when you are going to have hundres of items. Instead use the RecyclerView that recycles and reuses the views. ListView will be okay for the left drawer menu as its going to implement static number of elements that won't need recycling.
I am developing an activity with a ListView in which I need to change the current row by another layout by clicking on the row, and I'm not finding any way to do as much as I look (I take hours searching for possible solutions and I have not seen any reference to this problem). I do not know if this can be done in Android, but if anyone has an idea of how to do this would be appreciated.
Thanks in advance.
PS: The ListView control is normal and just want to replace a layout with a different layout. I'm using the API 15.
Use a ViewSwitcher
http://developer.android.com/reference/android/widget/ViewSwitcher.html
A ViewSwitcher is -
ViewAnimator that switches between two views, and has a factory from
which these views are created. You can either use the factory to
create the views, or add them yourself. A ViewSwitcher can only have
two child views, of which only one is shown at a time.
I suggest merging the two layouts in a single one and hide the second one. In your adapter data you should have a flag or something to indicate which layout to display. When you click a row, toggle that flag for the selected item and notifyDataSetChanged() on the adapter. This will make sure the changed layout remains even if you scroll up and down and the row goes off screen.
A more optimized solution is to have different item types in the adapter.
I am working on an android app and I have to Implement the below screen. That screen has two buttons at the top just like we have in tab view, on changing the button 1 is for opening the Picture view and other is to view the videos screen. Below that buttons I have to Implement two listviews for video screen that will each contain one header like one for songs (below that will be a listview of songs) and second header is for films (below that will be a listview of films). And the data for both songs and films is coming from two different services, just like for songs http://mywebsite.com/songs and for films http://mywebsite.com/films. Now I am little bit confused about the UI that there are many alternatives to implement it, but not sure which one will be best for me.
Please give me some ideas about how to implement it. Should I use a Radio group for the above buttons and on State change it should call the respective method, for a view of video and picture. But for each view I will have to make two listviews , just like in the video screen one for songs and other for films. And making two listviews is little bit complex than a single listview. Is there any way to handle it by only one adapter and in that view the same headers should be there. Ad if someone has any good idea then please share it. Any help will be highly appreciated.
You should consider to use fragments for your tab functionslity.
An alternative for two list views could be one expendablelistview. With two groups. You can add multiple types of items to any list view. You just have to overwrite the getitemtype Methode and define the different types you want to display in your listview.
1) hey bro, firstly u hv to create a swap view with a navigation tab functionality on it. check out this link http://developer.android.com/training/implementing-navigation/lateral.html
2) the above example will provide you 2 fragment pages that you can use for picture and videos separately. You can create the layout of every page as you like via using separate fragment with their own layout as you wish.
3) Now in video layout fragment, you can use 2 list views one by one in the linear layout with orientation vertical. Check this link to get idea how to implement your custom list view. http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/
4) You have to put the value of Android:weightSum="2" in parent layout( linear layout with orientation vertical) and put Android:layout_height="0dp" & Android:layout_weight="1" in each list view. This will provide equal space for both the list view in single screen for each type of device.
I've a two column layout and want it working like the "Settings" on a android 4 on a tablet.
On the left a menu (it's a ListView) and depending on the action on the list view I want to load an activity on the right column.
How can I achieve this? I'm unsure of what keywords to use to search for a solution.
Sounds like you want fragments. What you would do is create an activity that allows for two fragments which you can customize how you want.
I want to create a horizontal listview which contain many item, one item will contain a image. When user slide listview => the count of item will be fix when it display, example display only 3 or 4 image. How can I do that? Many thanks.
Edit:
I use this
to create a HorizontalList view, everything is ok but I don;t know how to make the Next and Previous button work! Any idea?
Instead of a horizontal ListView (which, as far as I know, isn't offered by the Android SDK) you can use a HorizontalScrollView. You can add the items like to any other kind of layout class.
It looks like what you are looking for is a Paginated Gallery. I have written one here.
Its still only a couple of days old but hopefully the included Activity code will get you off the ground.