Android: AutoCompleteTextView top margin ListView - android

The AutoCompleteTextView displays a ListView in a popup for auto completion. On top of the popup, before the ListView begins, there ist a little margin, in effect the first line in ListView looks higher than the other entries. Is there a way to remove the margin. For me it is just a problem because a changed the "dropDownVerticalOffset" of the AutoCompleteTextView to be on bottom of the TextView, otherwise there is negative offset and you don't see the difference if height of the first line.
How can I remove this margin?

Try to add XML attribute to your AutoCompleteTextView:
android:popupBackground="color_what_you_want_to_background"
Hope, it helps you

Related

How to add top margin on first item in the ListView?

This is a pretty simple question. I would like to add a top margin to the first item in my ListView. Is that possible?
just add topPadding and android:clipToPadding="false" to ListView

Make First line height in textview the same as other lines

I have a recyclerview with bunch of textview each as an item as you see in picture below. (Blue lines aren't really there, i added them so you can see each item separately) as you can see everything seems nice and user will not notice the text is separated.
The problem is when user increases the line space(a typical option in app) line height gets bigger except the first and last line of each item and the result seems like second picture.
My question is how to find appropriate padding to set to each item so every line height seen exactly the same?
BTW i can not use just one textview for many reason!
You can increase the divider height of your listview according to linespacing height.
Or you can set an invisible view at the bottom of every row item and increase the height of this view according to linespacing height.
Or you can set padding at the bottom of every row item and increase the value of this padding according to linespacing height.
just add some padding to the parent of your textview in the layout file of your list item .
for example the layout with linearlayout would be like :
<LinearLayout ........
paddingTop=15dp>
<TextView
..........>
</TextView>
</LinearLayout>
and you could adjust the padding dynamically if you want.

How to keep EditText from breaking to the next line when width does not match_parent?

I am trying to fit two EditTexts horizontally. What I am trying to accomplish is make the text keep scrolling right without the EditText extending in anyway when there is no more space in that specific EditText. This happens when the EditText is set to match_parent (width), but when I set an actually width or wrap_content, it breaks to the next line. Not the behavior I am hoping for. Any ideas?
If I understood your question correctly, you're saying you want the edit text to be a single line each? If so, have you tried using the xml attribute
android:singleLine
Or you can accomplish the same thing with:
setSingleLine() //called on the edit text
I just tested it out with 2 edit texts in a horizontal linear layout set to 100dp width each and I think it accomplishes the behavior you want.
You can try this:
Set both to fill_parent and layout_weight=1. This will align them side by side.

How to get some space below my last list item alone- android

I have a list whose height is set to "fill parent". everything works fine but my last item in list touches the bottom of my screen. how can i get some space below my last list item.
You can add an empty view as footer: http://developer.android.com/reference/android/widget/ListView.html#addFooterView(android.view.View)
AFAIK there's no way to do that only with XML, you can declare the footer in XML and inflate, or create programmatically
Here is a 3-liner to add a spacer programmatically:
View listFooter = new View(this);
listFooter.setLayoutParams(new AbsListView.LayoutParams(AbsListView.LayoutParams.FILL_PARENT, 70)));
listView.addFooterView(listFooter);
uhmm.. seeing that you don't want padding, print a blank line (or transparent text) on a textview located after your listview. Or print a "extra" item on your listview.
you could use the Space widget
<android.support.v4.widget.Space
android:layout_width="match_parent"
android:layout_height="10dp"/>
can simply set the margin in the list ............
if need only bottom margin then use : android:layout_marginBottom=

Android - show footer divider but no list row divider

I have a list view which has a footer.
It displays numbers and at the bottom is the total.
I want to be able to show the rows without a divider between them. OTOH I DO want a divider before the summary row.
Is there any easy way to do this?
You can set android:dividerHeight to 0 in your list.
Then use custom layout for footer in which you add divider by yourself. For example, that can be a TextView with no text, android:layout_height set to 2 and android:background set to some color.
When you have custom layout for the footer, just add divider on top of it. It can be for example View of hight 2dp and different background color.
I had to do this programatically, since setting android:dividerHeight="0dip" in the XML didn't work for me:
getListView().setDividerHeight(0);

Categories

Resources