My problem is to show a box with a textView (for example) with specified layout_gravity or layout_margin at the sony ericsson xperia.
For other devices the following code do what it should do but not for the xperia. Using it at xperia the box is showing on the right side always. There works no centering and no margin.
Do anybody knows how I can fix it?
message.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/message"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/rounded_border"
android:layout_gravity="bottom|center_horizontal"
android:minWidth="0dp"
android:minHeight="0dp"
android:layout_marginBottom="22dp"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginTop="10dp"
>
<TextView android:id="@+id/messsage_text_id" android:gravity="left"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@+id/message_text"
android:textSize="14sp"
android:textColor="@color/whiteColor"
android:layout_margin="7dp"/>
</LinearLayout>
JavaClass.java
...
LayoutInflater inflater = ((Activity)context).getLayoutInflater();
mMessageView = inflater.inflate(R.layout.message, parentView, false);
((Activity)context).addContentView(mMessageView, mMessageView.getLayoutParams());
setText("message");//default text
mMessageView.setVisibility(View.VISIBLE);
...