I have an application to show the MapView having both height and width fill_parent. I need to overlay some text on the top part of the Map View. How to do this?. The background of text should be transparent. Also the text has the property of marquee. Is it possible to do this?
Use a RelativeLayout as the root container of you layout and add the MapView and a TextView to it (below the MapView in the layout xml file). Use the TextView to display the text which should be displayed above the map. Now you can use the attributes starting withlayout_ to place the TextView where you want it.
As far as I know, the marquee effect only works when the TextView is focused and its text value is too long to fit in the whole TextView.
The TextView's background should be transparent by default.
Create a RelativeLayout as the container of your Mapview and a TextView
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<MapView .../>
<TextView /> </RelativeLayout>
You can display the TextView where you want with the RelativeLayout child attributes, for example on the textView : layout_alignParentBottom="true"
Otherwise just use an itermized overlay to put the text in.
Related
What I want to achieve is something like this, a seekbar without any top and bottom padding:
What I get is this:
I tried even setting the background to transparent and then null but the background of the seekbar becomes white, it doesn't look like in the first image, I want the seekbar to look like it's placed between the both layouts (the upper layout is darker, and the layout from the bottom is lighter as you see in both photos). I'm using the basic attributes for the seekbar in xml, thanks!
EDIT:
This is the seekBar in XML.
I don't believe that it has something to do with the root layout, because everywhere if I'm starting a new project and I'm adding a seekbar it still has that background, and if I try to set it to transparent it becomes white.
<SeekBar
android:id="#+id/window_song_seekbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/primaryColor"
android:paddingLeft="0px"
android:paddingRight="0px" />
Set following attributes in xml.
'android:paddingStart="0dp"
android:paddingEnd="0dp"'
SOLVED, bad layout positioning. I was using a LinearLayout as the root element with a vertical orientation, the seekbar was at the middle of two relative layouts, I used android:background="#color/myColor" for the root layout, then setting the background to transparent to the seekbar and now I got the desired effect. And also I changed the root layout from linear layout to a relative layout. Thank you! :)
I have the following pseudo layout:
<RelativeLayout>
<ACustomView />
<AnotherCustomView />
</RelativeLayout>
I have TextViews in both of the custom views (inflated from XML). How can i set
style properties (eg. textColor) for every TextView in the first custom view? For example i want every TextView to be red which are in the first custom view.
I don't think that this is possible.
If you don't want to much typing you can define your own style and add it to each textview or you can create your own textview class where style attributes are set.
For an example use this question/answer:
Setting global styles for Views in Android
I hope i could help you
Cu
JackZ
I have this layout:
It was a bit tricky to put ListView inside ScrollView, but it worked.
When the list is large and the scroll appears when scrolling .. everything up, including the form. That is ok!
Now I would like to put a TextView fixed at the bottom of the screen. As a total
Tried to wrap everything with a RelativeLayout put layout_weight = "1" in ScrollView. Worked. But when the keyboard appears, rises along the TextView and do not want it.
How do I set a TextView at the bottom of the screen, without moving when the keyboard appears?
Put everything in a relative layout. Add the TextView to the relative layout, set layout_alignParentBottom on TextView. Then on the ScrollView set layout_above referencing the TextView.
Follow the design hierarchy:
<LinearLayout.....>
<ScrollView>
<You Old Views/>
</ScrollView
<TextView> .. </TextView>
</LinearLayout>
I created custom dialog and i have textview in it. Text is pretty close to edge of my dialog box, so i wonder if I can set some space between my text and left and right edge of dialog box and how ??
In your custom dialog's xml layout add the following to the root:
android:padding="10dp"
Or whichever value you see fit.
You need to create your TextView with some marginLeft and marginRight attributes.
These will put some space between your TextView and the left, right edges of the screen.
Also consider using paddingLeft, paddingRight attributes to ensure that there is some space between the border of your TextView and the actual text itself.
Look here for more information about how you can set these parameters in a TextView.
I am displaying the TextView within a RelativeLayout.
I want to put the TextView at the center of the Layout.
Within the layout xml,
for TextView am using the property android:gravity="center" is not working .
I do not want to hard code by using android:layout_marginLeft or Right since it can give different effect in portrait or landscape mode.
Is there property so that it looks the same for both landscape & portrait mode & the TextView occupies the center of the Layout
Since RelativeLayout is your TextView's parent, you simply set android:layout_centerInParent="true" on your TextView. No other properties are needed.