I am trying to put a list view in a scroll view which is not possible as I found in several similar questions.
I have a quite large menu to be placed above list view, which completely hides the list view on small screens, so I need a scroll view which is not possible. I read that I should use a linear layout instead of list view to solve this problem. But not sure how to setup up an adapter on linearlayout. I am using a lazy adapter for image loading in the list view.
Code:
LinearLayout list=(LinearLayout)findViewById(R.id.listActivities);
adapter=new LazyAdapter(this, activityList);
list.setAdapter(adapter);
As I understand from your question there is a single view that you wonna put at the top of your list view. Try to use ListView.addHeaderView(View v) for that purpose. See android API documentation for more info.
You can add a view as header to the list view, which will solve your problem, it will place the view in the list view but on the top of list items.
listview.addHeaderView(yourview)
you can add HorizontalScrollView in your listview header where in HorizontalScrollView you can add linearlayout & horizontal menus in it
or
other option is to have one simple button in header of listview say action & clicking on that open new dialog with list of menus (actions) etc...
Related
I want to create item adapter with a mosaic view include multiple images.
I found some libs: AndroidMosaicLayout,
QuiltViewLibrary.
But these show on the main view. In my case, I want to show images on the item adapter recyclerview.
It's same the row on facebook row new feed.
Any help, thanks.
You cam do it using the library AndroidMosaicLayout. In the layout used for the adapter of the RecyclerView just add the view of AndroidMosiacLayout and inside the recyclerview adapter, just inflate the layout resources and access the AndroidMosiacLayout normally by assigning the required layout pattern and data. At the end the AndroidMosiacLayout it is just a NestedScrollView, so you can use it the same way you use any other view or view group.
I have a ImageView with a TextView and Button. I have it currently in a custom list view, but I noticed now that I don't need to show more as one element (object). So I actually don't need a Listview to show the row (list entry). How can I show the list entry without a Listview?
You can put the elements of your custom listview item into a Layout, e.g. LinearLayout and simply add it to your activity's layout where you needed it.
You can set an OnClickListener for that layout, so user can click the whole thing.
I think you should use ListActivity. Then you can set up empty view for list. Here some tutorial: ListActivity and ListView Tips.
Also you can implement that logic with Recycler view by yourself or use library.
Here is solution from stackoverflow
Can we append component from async task to main activity (add a component beneath the main activity)
you can use open source libraries like.. Sephiroth Horizontal listview
Meetme Horizontal listview and there is many other libraries. you can grab than on github.
NOTE Google your question before asking and search on stackoverflow you will surely get your answer.
See, 1. if you have a listview already created. and want to add more items same as first listview items. you can add the items to the adapter.but items should be same. or so. (I am not clear)
2. if it is not listview (may be it is linear layout horizontal) in this you can also add views in your onPostExecute().
In listView how can we add view is like
ListView lv= (ListView)findViewById(R.id.listview);
assume you have set the adapter.now you want to add a view.
lv.addFooterView(here you can add view layout);
same you can do with (linear layout.)
I have this row item in my custom list view, and in my array-adapter which I'm using to populate data in this list contains another list in each item. Which I want to show inside the layout out with arrows (shown in image above).
Any tutorial would be helpful
It sounds like you want a create your own View for each item in your listview.
This view would probably be a LinearLayout that you could programatically add new views to. Simply loop through your list within each item, generate the textview / image / whatever that you need, and add it to the linearlayout.
Note: your inner list can't be scrollable independently of the main listview.
I have a Listview in my Android app, and I want there to be some horizontal lines when the list is empty to indicate to the user that this is a List. I know that there is the setEmptyView method on ListView, but I'm not sure what to put in that view if I want there to be list rows with horizontal lines. How would I accomplish this?
Having a bunch of horizontal lines for an empty list is an iOS convention. If you want your app to fit in with Android better you should set something else. Perhaps notify the user there was an error or that there are no items in the list. You can add this right to your layout.xml file if you're using a ListActivity. All you need to do is create a view and give it the id #android:id/empty.
put the listView in a FrameLayout and add another view in that Frame.
if you having any item in the list hide its (visiblity="gone") and show the other view.
OR
change your adapter to return multi ViewType
in your adapter if you have no item return other type of view