Layout does not match preview

I have developed an action plan that appears when the user clicks a button. This is a separate XML file that I am including in another layout file. In the layout view, it looks the way I want. However, when it works on my phone, the layout is messed up.

Here's how it should look:

Should look

And here is what it looks like: Does look

Can anyone understand why this could happen?

Here is the layout code for the action sheet. A section that does not display correctly is in the last line layout

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/sheet_header" >

        <ImageButton
            android:id="@+id/left_justified"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/center_justified"
            android:layout_toLeftOf="@+id/center_justified"
            android:background="@android:color/transparent"
            android:src="@drawable/alignment_left" />

        <ImageButton
            android:id="@+id/center_justified"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="13dp"
            android:background="@android:color/transparent"
            android:src="@drawable/alignment_center" />

        <ImageButton
            android:id="@+id/right_justified"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/center_justified"
            android:layout_toRightOf="@+id/center_justified"
            android:background="@android:color/transparent"
            android:src="@drawable/alignment_right" />

        <ImageButton
            android:id="@+id/close_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/center_justified"
            android:background="@android:color/transparent"
            android:layout_alignParentRight="true"
            android:layout_alignTop="@+id/center_justified"
            android:layout_marginRight="10dp"
            android:src="@drawable/sheet_done_btn"
            />
    </RelativeLayout>

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/sheet_background"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dp" >

            <TextView
                android:id="@+id/font_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1.0"
                android:gravity="center"
                android:text="Font"
                android:textColor="#806014"
                android:textSize="20sp" />

            <TextView
                android:id="@+id/size_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1.0"
                android:gravity="center"
                android:text="Size"
                android:textColor="#806014"
                android:textSize="20sp" />

            <TextView
                android:id="@+id/color_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1.0"
                android:gravity="center"
                android:text="Color"
                android:textColor="#806014"
                android:textSize="20sp" />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

And here is how it turns on:

<FrameLayout 
    android:layout_alignParentBottom="true"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:id="@+id/edit_text_frame">  

    <include layout="@layout/edit_text"/>
</FrameLayout>

Edit: In addition to fixing this specific problem, does anyone know why the preview does not match the way it actually displays on the phone?

Thanks for the help!

+3
source share
2
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/sheet_header" >

        <ImageButton
            android:id="@+id/left_justified"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/center_justified"
            android:layout_toLeftOf="@+id/center_justified"
            android:background="@android:color/transparent"
            android:src="@drawable/alignment_left" />

        <ImageButton
            android:id="@+id/center_justified"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_marginTop="13dp"
            android:background="@android:color/transparent"
            android:src="@drawable/alignment_center" />

        <ImageButton
            android:id="@+id/right_justified"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/center_justified"
            android:layout_toRightOf="@+id/center_justified"
            android:background="@android:color/transparent"
            android:src="@drawable/alignment_right" />

        <ImageButton
            android:id="@+id/close_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/center_justified"
            android:background="@android:color/transparent"
            android:layout_alignParentRight="true"
            android:layout_alignTop="@+id/center_justified"
            android:layout_marginRight="10dp"
            android:src="@drawable/sheet_done_btn"
            />
    </RelativeLayout>



        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="15dp" 
        android:background="@drawable/sheet_background"
        android:orientation="vertical" >

            <TextView
                android:id="@+id/font_text"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center"
                android:text="Font"
                android:textColor="#806014"
                android:textSize="20sp" />

            <TextView
                android:id="@+id/size_text"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center"
                android:text="Size"
                android:textColor="#806014"
                android:textSize="20sp" />

            <TextView
                android:id="@+id/color_text"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:gravity="center"
                android:text="Color"
                android:textColor="#806014"
                android:textSize="20sp" />
        </LinearLayout>


</LinearLayout>
0

, , TextViews .

0

All Articles