Reputation: 3313
friend'd I need to display image has background and transparent text at particular location of the image text,here my problem is it display well in some devices and not being proper alignment in larger screens,even i used seperate resource file like layout,layout-large,layout-small but in some case it's not working well,i set
android:normalScreens="true" android:smallScreens="true"
android:anyDensity="false" /> in my manifest file,![alt text][1]
here my screenshot i need the black and white colour text being placed exactly on yellow coloured text. here my xml code,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_gravity="center_horizontal" android:layout_width="wrap_content"
android:layout_height="fill_parent">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:background="@drawable/about_brown"
android:layout_gravity="center_horizontal" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView android:id="@+id/about_mail_text1"
android:textSize="12sp" android:textColor="@color/black"
android:layout_marginTop="190dp"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@string/ab_t1" android:layout_marginLeft="135dip" />
<TextView android:id="@+id/about_mail_text2"
android:layout_below="@id/about_mail_text1"
android:textSize="12sp" android:textColor="@color/black"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="156dip" android:text="@string/ab_t2"
android:layout_marginTop="2dp"/>
<TextView android:id="@+id/about_mail_text3"
android:layout_below="@id/about_mail_text2"
android:textSize="13sp" android:layout_marginTop="73dp"
android:textStyle="bold" android:textColor="@color/white"
android:gravity="center_horizontal" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:text="@string/ab_t3" />
<TextView android:id="@+id/about_mail_text4"
android:layout_below="@id/about_mail_text3"
android:textSize="13sp" android:textStyle="bold" android:textColor="@color/white"
android:layout_marginTop="50dp" android:gravity="center_horizontal"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:text="@string/ab_t4" />
</RelativeLayout>
</LinearLayout>
how can i get it,please help me.
Upvotes: 0
Views: 402
Reputation: 4039
This might be one of those rare situations where AbsoluteLayout is the best option. Instead of this...
<TextView
android:id="@+id/about_mail_text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/about_mail_text1"
android:layout_marginLeft="156dip"
android:layout_marginTop="2dp"
android:textSize="12sp"
android:textColor="@color/black"
android:text="@string/ab_t2" />
... change to an AbsoluteLayout and then try this...
<TextView
android:id="@+id/about_mail_text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="156dp"
android:layout_y="2dp"
android:textSize="12sp"
android:textColor="@color/black"
android:text="@string/ab_t2" />
Upvotes: 1