How to write this layout in xml - android

The TextView icon is not a Compound Drawable since the bottom line doesnt cover it.
How to define a layout like this where beside each text is an icon?
I just see ugly to add so much ViewGroups in the same view just to have the icon because there will be a lot of text input in the view.

use drawableLeft property of textview to set an icon with your text, it will create a single view with your icon and your text.
android:drawableLeft="#drawable/icon"
android:drawableBottom="#drawable/icon_line"

Related

Show Triangular tag on layout

How to add the trianle shape with corner on layout like popular.
You can display the Popular text as an image view or You can use this library to display the text from TextView
You can modify the properties like corner,labelPadding,primaryText,primaryTextColor
https://github.com/shts/TriangleLabelView

How to make parent background opaque but keep child element non opaque?

Hi guys I am new to Android .I want to make the layout given in the image.
I want to achieve the effect inside the red box.How can I make the background opaque while its keep its child opaque?
I tried this as,
The part inside the red box as RelativeLayout, which has a TextView (value as Contact details) I gave android:alpha=0.3 for relative layout,but the problem is,it makes the TextView also opaque (which is logical)
I just want some thoughts to move in that direction.
Create a color resource with an alpha component of 0.3 and set it as the background of the RelativeLayout
In the colors.xml
<color name="opaque_black">#4c000000</color>
In the layout of the View
<RelativeLayout
...
android:background="#color/opaque_black"
...>

Centering text inside the label view of the android actionbar

This is the label of my activity in the actionbar with "Show layout bounds" option enabled.
As you can see the label area is centered, but the text inside it is moved to bottom. So it appears like the text is not centered.
How to center the text vertically?
You should provide some additional information like the definition of the layout.xml file.

How to change text size and colour in listview in android?

I binded one image and three textviews in listview.Now i want change the size and colour of each textview in listview.
is it possible........please help me.
You will probably have a custom layout file for your list items in which you specify the image and the textviews. In this same layout file you can change the size and color of the text using the android:textSize and android:textColor attributes (see also http://developer.android.com/reference/android/widget/TextView.html).

Text alignment line by line in android Text-view using Gravity

Can we align our text line by line(I mean whatever the text we have selected that should be aligned instead of the whole text) in android text-view dynamically!!
I think you need to draw text to your textview then. I have not seen a direct way to do it on a TextView

Categories

Resources