I now how to make a ListView with headers (there are tons of examples), but what I want to do is a ListView with headers and when one of the sections scrolls, the header would still be there.
I think I found one... but now I cannot find it again...
It's just like Contacts app. I hope you can help me!
Thanks
Just a trick you may go for it:
Take LinearLayout with vertical orientation
Put one textview with width fill_parent and height Wrap_content
Then put your ListView with both height and width fill_parent.
Hope it will work. :)
Just put another layout before ListView
You can use listView.addheader(yourlayout) method to add the header
priavate ListView l1;
extend your listView from layout
use this
Create a view For Header in your main layout file
l1.addHeaderView(View v) to add Header
Related
I am following a tutorial on grid layout. In particular, I am replicating Suragch's answer.
The code itself is working fine, except I would like to center the RecyclerView in the activity.
I've tried
android:gravity="center"
and
android:layout_gravity="center"
on both the RelativeLayout AND RecyclerView, but neither works.
Also, I would like to eliminate the gaps between each column. Does anyone know how to go about doing this?
Try android:layout_centerInParent=true into <RecyclerView>
Depending on your parent Layout
If its RelativeLayout then
android:layout_centerHorizontal=true in RecyclerView
if its LinearLayout then
android:layout_gravity=center_horizontal in RecyclerView
One more interesting thing you can do in Adapter
the main parent Layout in adapter
try doing this
android:gravity=center_horizontal in main layout of adapter
I have created a gridView layout with a RecyclerView and have also created the necessary adapter class to populate its cells with imageViews.However, i can't figure out how to make the imageViews larger or set a custom length and width for them.In a previous project, i was using LayoutParams directly on the imageViews like this:
imageView.setLayoutParams(new GridView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
But that doesn't seem to work here.Any ideas?
If anyone is interested, i solved it by implementing the solution to this question : match_parent width does not work in RecyclerView.
I've seen many of questions for how to add TextView in a RelativeLayout programatically, but everybody adding it in LinearLayout with orientation vertical. Can any one suggest me or give me a link that how to add multiple TextView in RelativeLayout at right until it has space and then change the line.
I want a layout like this..
May be this works for you !
You can customize chips-edittext-library for your need. Customizing by setting background to transparent, and editable to false.
-> Or you can use any other library which is used for displaying emoticon in EditText and customize it according to your need. Like android-emoticon-edittext-spike
You can use the Flow Layout library that manages the view arrangement itself.
When there is no space left the added View is moved to the next line
I'm adding 2 different views in my ListView header view but for some reason it create a 20dp space between those 2 views. How should I remove it?
Thanks!
Edit : The 2 views I add don't have any top/bottom padding or margins, I'm asking if there is any special "feature" in the ListView headerView about space/separator between views.
Edit 2: it seems that the space between the view in my header view is tied to the dividerHeight parameter. Why? I mean it should only be applied as rows separator. Is there any way to remove it from my headerView and keep it as actual row separator ? headerDividersEnabled=false don't do anything.
try to set android:headerDividersEnabled="false" in the ListView
i have same issue i have added dynamic header to listview but on the start of activity it gives space on the top of headerview and we scroll listview then header view overlaps with it instead of going up.
Folks, I have the following layout: http://dpaste.com/hold/755261/
It has two seekbar widgets. Both are not showing. If I move them to the root linearlayout, they appear, otherwise not. I need them to be inside the first linearlayout. Anyone could help me how to achieve that?
It looks like you need to put the following in your third LinearLayout:
android:layout_weight="1"
Change the second LinearLayout height to wrap_content. If the content doesn't fit on the screen, then maybe you have to use a ScrollView.