Android - 文本重叠在横向而不是纵向

时间:2013-11-08 11:28:05

标签: java android layout

所以我有一个小问题。当我处于纵向模式并单击某个项目时,确认页面出现并且很好。但是当你把它转向风景时,一些文字会被覆盖但是按钮。见图: Overlapping

但是,如果我点击景观中的项目,它不会重叠。任何人都可以看到我出错的地方。

以下是横向代码:

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

    <LinearLayout
        android:id="@+id/fragment_one_click_message_layouts"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <include layout="@layout/fragment_one_click_message_layout" />

        <ImageView
            android:id="@+id/fragment_one_click_horizontal_line"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:src="@color/thin_line" />

        <LinearLayout
            android:id="@+id/fragment_one_click_reservation_detalis_layout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:orientation="vertical" >

            <RelativeLayout
                android:id="@+id/fragment_one_click_reservation_number_layout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <TextView
                    android:id="@+id/fragment_one_click_reservation_message_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/fragment_one_click_reservation_message_text" />

                <TextView
                    android:id="@+id/fragment_one_click_reservation_number_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@id/fragment_one_click_reservation_message_text"
                    android:layout_toRightOf="@id/fragment_one_click_reservation_message_text"
                    android:textColor="@color/one_click_reservation_number_text"
                    android:textSize="20sp"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/fragment_one_click_reservation_store_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/fragment_one_click_reservation_number_text"
                    android:text="@string/fragment_one_click_reservation_store_text" />

                <TextView
                    android:id="@+id/fragment_one_click_reservation_store_name_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@id/fragment_one_click_reservation_store_text"
                    android:layout_toRightOf="@id/fragment_one_click_reservation_store_text"
                    android:text="TEST TEST TEST TES"
                    android:layout_toLeftOf="@+id/fragment_one_click_cancel_reservation_button_tablet_land"
                    android:textStyle="bold" />

                <TextView
                    android:id="@+id/fragment_one_click_reservation_until_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/fragment_one_click_reservation_store_text"
                    android:layout_marginTop="15dp"
                    android:text="@string/fragment_one_click_reservation_until_text" />

                <TextView
                    android:id="@+id/fragment_one_click_reservation_until_time_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBaseline="@id/fragment_one_click_reservation_until_text"
                    android:layout_toRightOf="@id/fragment_one_click_reservation_until_text"
                    android:textStyle="bold" />

                <Button
                    android:id="@+id/fragment_one_click_cancel_reservation_button_tablet_land"
                    android:layout_width="200dp"
                    android:layout_height="40dp"
                    android:layout_alignParentRight="true"
                    android:background="@drawable/one_click_cancel_red_button"
                    android:text="@string/one_click_button_cancel_reservation" />
            </RelativeLayout>
        </LinearLayout>

        <RelativeLayout
            android:id="@+id/fragment_one_click_store_details_layout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="10dp" >

            <Button
                android:id="@+id/fragment_one_click_store_details_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@color/grey"
                android:padding="10dp"
                android:text="@string/one_click_store_details" />
        </RelativeLayout>

        <LinearLayout
            android:id="@+id/fragment_one_click_reservation_until_layout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:orientation="vertical" >

            <TextView
                android:id="@+id/fragment_one_click_reservation_details_sent_text"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="@string/fragment_one_click_reservation_details_sent_text" />

            <LinearLayout
                android:id="@+id/fragment_one_click_reservation_mobile_layout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/fragment_one_click_reservation_mobile_message_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="@string/fragment_one_click_reservation_mobile_message_text" />

                <TextView
                    android:id="@+id/fragment_one_click_reservation_mobile_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:textStyle="bold" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/fragment_one_click_reservation_email_layout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:orientation="horizontal" >

                <TextView
                    android:id="@+id/fragment_one_click_reservation_email_message_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="@string/fragment_one_click_reservation_email_message_text" />

                <TextView
                    android:id="@+id/fragment_one_click_reservation_email_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:textStyle="bold" />
            </LinearLayout>

            <Button
                android:id="@+id/fragment_one_click_cancel_reservation_button_tablet_port"
                android:layout_width="200dp"
                android:layout_height="40dp"
                android:layout_marginTop="10dp"
                android:background="@drawable/one_click_cancel_red_button"
                android:text="@string/one_click_button_cancel_reservation" />

            <RelativeLayout
                android:id="@+id/fragment_one_click_reservation_my_account_layout"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="10dp" >

                <TextView
                    android:id="@+id/fragment_one_click_reservation_my_account_text"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:lines="3"
                    android:text="@string/fragment_one_click_reservation_my_account_text_tablet" />

                <Button
                    android:id="@+id/fragment_one_click_account_button"
                    style="@style/alternatesmallbutton"
                    android:layout_width="140dp"
                    android:layout_height="35dp"
                    android:layout_alignParentRight="true"
                    android:layout_marginTop="4dp"
                    android:text="@string/one_click_my_account" />
            </RelativeLayout>
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/progress_bar"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:gravity="center_horizontal" >

        <ProgressBar
            android:id="@+id/fragment_pdp_add_to_trolley_progress_collection"
            style="@style/progress_spinner"
            android:layout_width="40dp"
            android:layout_height="40dp"
            android:layout_gravity="center"
            android:visibility="visible" />
    </LinearLayout>

    <ImageView
        android:id="@+id/fragment_one_click_horizontal_line"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dp"
        android:src="@color/thin_line" />

</LinearLayout>

1 个答案:

答案 0 :(得分:1)

将按钮的WIDTH设置为WRAP CONTENT,并为按钮设置PADDING以使按钮看起来更大,并将按钮设置为ID“保留在信息文本”的右侧。