Android - divider between items in vertical layout [duplicate] - android

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Android Drawing Separator/Divider Line in Layout?
I am making something similar to a list view, without actually making a list view...
I have a bunch of text views in a vertical layout, and I am wondering if it is possible to get some sort of divider line in between them. The line dividers like they have in List Views..
Any help?

You can use a textview to create a divider line
Example:
<TextView
android:layout_width="fill_parent"
android:layout_height="1px"
android:background="#DADADA" />

You can insert View with background of any color you want and
layout_height = "1dp" (or more if necesary) and
layout_width="fill_parent".

Related

Is there a difference between android:layout_centerVertical and android:layout_gravity="center_vertical"? [duplicate]

This question already has answers here:
What's the difference between layout_gravity="center_vertical" and layout_centerVertical="true"
(2 answers)
Closed 8 years ago.
I guess the title says it all. What is the difference between the two (if there is one) XML attributes and when would one be better used over the other?
...
android:layout_gravity="center_vertical"
...
and
...
android:layout_centerVertical="true"
...
Well, layout_centerVertical is only valid for RelativeLayouts. Gravity is also valid for linear layouts, so you could tell a LL with horizontal orientation to center objects vertically that otherwise would be top or bottom aligned.

Android Eclipse how to add an image button with text [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do I use a compound drawable instead of a LinearLayout that contains an ImageView and a TextView
I currently just have just a button with text in it but now I want to add a background image to it. But I don't want the background image to cover the whole button. I would like it to look something like the buttons in this picture. (Look at the picture under the app screenshots, it's the first image.) Here is a link to the picture.
https://play.google.com/store/apps/details?id=com.pxstudios.minecraftpro&feature=related_apps#?t=W251bGwsMSwxLDEwOSwiY29tLnB4c3R1ZGlvcy5taW5lY3JhZnRwcm8iXQ..
You mean the list view with the text to the right of the buttons? You use two views, a text view and an image view
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<ImageView ...>
<TextView ...>
</LinearLayout>
You can do something like this:
<Button
android:id="#+id/button_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/[your_image]"
android:text="Your_Text"
android:textSize="48dp" //<==give a dimension to a text
android:textStyle="bold"//<==is better your text is bold
/>
If u use Eclipse, use graphic editor to create how many buttons you wants, just copy and paste in your Xml file. And use Strings.xml to store your text.
You can use android:drawableLeft attribute to set the icon to the left. Button is derived from TextView so it supports this attribute,

textView without any default padding while increasing size of textView [duplicate]

This question already has answers here:
Android: TextView: Remove spacing and padding on top and bottom
(23 answers)
Closed 6 years ago.
I want to remove default padding on textView. when i increase the size of textView then it's padding size increases automatically. even i set background of text View as "#null". i just want to show only text without any padding. my View looks like this first images and i want to show like second images.
first image
second image
Maybe this help you
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="0dip"
android:layout_margin="0dip"
android:background="#android:color/transparent" />
Edit:
Try this two attributes:
android:maxWidth="...dip"
android:maxHeight="...dip"
Try android:includeFontPadding="false" or set the height as same as text size instead of "wrap_content"

Simple Layout Conundrum - Why is Rhode Island trying to be Texas? (why is EditText using the entire width)? [duplicate]

This question already has answers here:
Why would layout_width="wrap_content" take up the entire width of the screen?
(3 answers)
Closed 8 years ago.
I've finally wrassled an Activity/Screen so that it is pretty much as I want it, but I've still got a stubborn EditText that needs to be the size of Rhode Island and insists on being Texas-sized. Here is the xml:
<TableRow >
<EditText
android:id="#+id/editTextMilesBeforeNotification"
android:layout_width="100px" />
</TableRow>
Your problem is that the width specification in your xml is ignored. From the docs for TableRow:
The children of a TableRow do not need to specify the layout_width and layout_height attributes in the XML file. TableRow always enforces those values to be respectively MATCH_PARENT and WRAP_CONTENT.
P.S. Did you have a compelling reason to use absolute pixels? That's generally considered bad practice.

Setting the height of the TabWidget on Android? [duplicate]

This question already has answers here:
Don't want icons on my TabWidget
(2 answers)
Closed 3 years ago.
I'm making an Android app that has a TabWidget along the bottom of the screen.
I want the tabs to all be 77px (or, dp, I suppose) high. To do this, I've added the following lines of code:
<FrameLayout
...
android:layout_height="77dp"
/>
<TabWidget
...
android:layout_height="77dp"
/>
This elevates the tabs above their original position, however, rather than the tabs actually getting taller, there's simply white space added beneath the tabs. Here is a screenshot to show what I mean.
Does anyone know how to increase the height of an Android tab widget / tabs themselves? Thanks in advance!
Can you post the entire layout? I'm curious to see what you did to get the tabs to align at the bottom. Try using the padding top and bottom to see if that helps.
android:paddingTop="39dp"
android:paddingBotom="38dp"
if this doesn't help please post your entire layout.

Categories

Resources