3

所以我最近ADT 21.1通过Android SDK Managerfrom更新到eclipse,然后我继续更新了 eclipse。

一切正常,我的项目按预期加载。到目前为止一切都很好,但后来我进入我的项目布局进行了一些调整,并意识到有些布局在编辑器中显示错误。

准确地说,我有一个布局,其元素与父底部对齐并且也有底部边距,这在我的任何手机上都可以正常工作,但是编辑器只是忽略了底部边距并将元素放在底部.

这是我正在谈论的布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background" >
    <!-- titlebar -->
    <TextView
        android:id="@+id/m_oTitlebar"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:background="@drawable/gradient_title"
        android:gravity="center_horizontal|center_vertical"
        android:paddingBottom="@dimen/contact_button_padding_vertical"
        android:paddingTop="@dimen/contact_button_padding_vertical"
        android:text="@string/contact"
        android:textColor="@color/white"
        android:textSize="@dimen/font_size_24"
        android:textStyle="bold" />
    <!-- logo and title -->
    <ImageView
        android:id="@+id/m_oLogo"
        android:layout_width="@dimen/contact_logo_dimension"
        android:layout_height="@dimen/contact_logo_dimension"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/m_oTitlebar"
        android:layout_marginTop="@dimen/contact_logo_margin_top"
        android:layout_marginLeft="@dimen/contact_logo_margin_left"
        android:contentDescription="@string/image_description"
        android:src="@drawable/logo" />
    <TextView
        android:id="@+id/m_oTitle_0"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/m_oLogo"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@+id/m_oLogo"
        android:layout_toRightOf="@+id/m_oLogo"
        android:layout_marginRight="@dimen/contact_logo_margin_left"
        android:gravity="bottom|right"
        android:text="@string/contact_title"
        android:textColor="@color/black"
        android:textSize="@dimen/font_size_18" />
    <!-- separator -->
    <LinearLayout
        android:id="@+id/m_oContact_Reference_Layout"
        android:layout_width="wrap_content"
        android:layout_height="@dimen/contact_reference_layout_height"
        android:layout_alignLeft="@+id/m_oLogo"
        android:layout_alignRight="@+id/m_oTitle_0"
        android:layout_below="@+id/m_oLogo"
        android:layout_marginTop="@dimen/contact_reference_layout_margin_top"
        android:orientation="vertical" 
        android:background="@drawable/gradient_contact"/>
    <!-- content -->
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_below="@+id/m_oContact_Reference_Layout"
        android:layout_above="@+id/m_oContact_Image_Send"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:layout_marginBottom="20dp"
        android:orientation="vertical"
        android:weightSum="4">
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_weight="1">
                <TextView
                android:id="@+id/m_oContact_Name"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/contact_name"
                android:textColor="@color/black"
                android:textSize="@dimen/font_size_20" />
             <TextView
                android:id="@+id/m_oContact_Sub"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center"
                android:text="@string/contact_sub"
                android:textColor="@color/black"
                android:textSize="@dimen/font_size_12"/>
        </LinearLayout>
         <TextView
            android:id="@+id/m_oContact_Location"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@string/contact_location"
            android:textColor="@color/black"
            android:textSize="@dimen/font_size_14"
            android:layout_weight="1"/>
         <TextView
            android:id="@+id/m_oContact_Phone"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@string/contact_phone"
            android:textColor="@color/black"
            android:textSize="@dimen/font_size_18"
            android:layout_weight="1"/>
         <TextView
            android:id="@+id/m_oContact_INet"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:text="@string/contact_homepage"
            android:textColor="@color/black"
            android:textSize="@dimen/font_size_18"
            android:layout_weight="1"/>
    </LinearLayout>
     <!-- send button and image overlay --> 
     <Button
        android:id="@+id/m_oContact_Button_Send"
        style="@style/ButtonMain"
        android:layout_width="@dimen/main_button_width"
        android:layout_height="@dimen/main_button_height"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="20dp"
        android:paddingBottom="@dimen/button_padding_vertical"
        android:paddingLeft="@dimen/button_padding_horizontal"
        android:paddingRight="@dimen/button_padding_horizontal"
        android:paddingTop="@dimen/button_padding_vertical"
        android:text="@string/empty"
        android:onClick="OnClick"/>
     <ImageView
         android:id="@+id/m_oContact_Image_Send"
         android:layout_width="@dimen/main_button_height"
         android:layout_height="@dimen/main_button_height"
         android:layout_alignTop="@+id/m_oContact_Button_Send"
         android:padding="@dimen/contact_image_padding"
         android:layout_centerHorizontal="true" 
         android:contentDescription="@string/image_description"
         android:src="@drawable/send"/>
</RelativeLayout>

我还发现我的另一个布局似乎有同样的问题

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background" >
    <!-- logo and title -->
    <ImageView
        android:id="@+id/m_oMain_Logo"
        android:layout_width="@dimen/main_logo_dimension"
        android:layout_height="@dimen/main_logo_dimension"
        android:layout_alignParentTop="true"
        android:layout_alignParentLeft="true"
        android:layout_marginLeft="@dimen/main_logo_margin_left"
        android:layout_marginTop="@dimen/main_logo_margin_top"
        android:contentDescription="@string/image_description"
        android:src="@drawable/logo" />
    <TextView
         android:id="@+id/m_oMain_Title"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_alignBottom="@+id/m_oMain_Logo"
         android:layout_alignParentRight="true"
         android:layout_marginRight="@dimen/main_logo_margin_left"
         android:layout_alignTop="@+id/m_oMain_Logo"
         android:layout_toRightOf="@+id/m_oMain_Logo"
         android:text="@string/main_title" 
         android:textColor="@color/zmvo_blue"
         android:textSize="@dimen/font_size_20"
         android:textStyle="bold" 
         android:gravity="bottom|right"/>
    <!-- buttons top left side -->
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_below="@+id/m_oMain_Logo"
        android:layout_above="@+id/m_oMain_Button_Search"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="30dp"
        android:layout_marginBottom="20dp"
        android:layout_alignLeft="@+id/m_oMain_Logo"
        android:layout_alignRight="@+id/m_oMain_Title"
        android:orientation="vertical">
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:orientation="vertical">
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginBottom="20dp"
                android:weightSum="2">
                <Button
                    android:id="@+id/m_oMain_Button_GOZ"
                    style="@style/ButtonMain"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:onClick="OnClick"
                    android:paddingBottom="@dimen/button_padding_vertical"
                    android:paddingLeft="@dimen/button_padding_horizontal"
                    android:paddingRight="@dimen/button_padding_horizontal"
                    android:paddingTop="@dimen/button_padding_vertical"
                    android:layout_marginRight="10dp"
                    android:tag="@integer/main_tag_goz"
                    android:text="@string/goz"
                    android:textColor="@color/black"
                    android:textSize="@dimen/font_size_20"
                    android:layout_gravity="center"
                    android:layout_weight="1" />
                <Button
                    android:id="@+id/m_oMain_Button_GOAE"
                    style="@style/ButtonMain"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:onClick="OnClick"
                    android:paddingBottom="@dimen/button_padding_vertical"
                    android:paddingLeft="@dimen/button_padding_horizontal"
                    android:paddingRight="@dimen/button_padding_horizontal"
                    android:paddingTop="@dimen/button_padding_vertical"
                    android:layout_marginLeft="10dp"
                    android:tag="@integer/main_tag_goae"
                    android:text="@string/goae"
                    android:textColor="@color/black"
                    android:textSize="@dimen/font_size_20"
                    android:layout_gravity="center" 
                    android:layout_weight="1"/>
            </LinearLayout>
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginBottom="20dp"
                android:weightSum="2">
                <Button
                    android:id="@+id/m_oMain_Button_BEMA"
                    style="@style/ButtonMain"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:onClick="OnClick"
                    android:paddingBottom="@dimen/button_padding_vertical"
                    android:paddingLeft="@dimen/button_padding_horizontal"
                    android:paddingRight="@dimen/button_padding_horizontal"
                    android:paddingTop="@dimen/button_padding_vertical"
                    android:layout_marginRight="10dp"
                    android:tag="@integer/main_tag_bema"
                    android:text="@string/bema"
                    android:textColor="@color/black"
                    android:textSize="@dimen/font_size_20"
                    android:layout_gravity="center"
                    android:layout_weight="1" />
                <Button
                    android:id="@+id/m_oMain_Button_FZ"
                    style="@style/ButtonMain"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:onClick="OnClick"
                    android:paddingBottom="@dimen/button_padding_vertical"
                    android:paddingLeft="@dimen/button_padding_horizontal"
                    android:paddingRight="@dimen/button_padding_horizontal"
                    android:paddingTop="@dimen/button_padding_vertical"
                    android:layout_marginLeft="10dp"
                    android:tag="@integer/main_tag_fz"
                    android:text="@string/fz"
                    android:textColor="@color/black"
                    android:textSize="@dimen/font_size_20"
                    android:layout_gravity="center"
                    android:layout_weight="1" />
            </LinearLayout>
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:weightSum="2">
                <Button
                    android:id="@+id/m_oMain_Button_BEB"
                    style="@style/ButtonMain"
                    android:layout_width="0dp"
                    android:layout_height="wrap_content"
                    android:onClick="OnClick"
                    android:paddingBottom="@dimen/button_padding_vertical"
                    android:paddingLeft="@dimen/button_padding_horizontal"
                    android:paddingRight="@dimen/button_padding_horizontal"
                    android:paddingTop="@dimen/button_padding_vertical"
                    android:layout_marginRight="10dp"
                    android:tag="@integer/main_tag_beb"
                    android:text="@string/beb"
                    android:textColor="@color/black"
                    android:textSize="@dimen/font_size_20"
                    android:layout_gravity="center"
                    android:layout_weight="1"/>
                <Button
                     android:id="@+id/m_oMain_Button_BEL"
                     style="@style/ButtonMain"
                     android:layout_width="0dp"
                     android:layout_height="wrap_content"
                     android:onClick="OnClick"
                     android:paddingBottom="@dimen/button_padding_vertical"
                     android:paddingLeft="@dimen/button_padding_horizontal"
                     android:paddingRight="@dimen/button_padding_horizontal"
                     android:paddingTop="@dimen/button_padding_vertical"
                     android:layout_marginLeft="10dp"
                     android:tag="@integer/main_tag_fz"
                     android:text="@string/bel"
                     android:textColor="@color/black"
                     android:textSize="@dimen/font_size_20"
                     android:layout_gravity="center"
                     android:layout_weight="1"/>
            </LinearLayout>
        </LinearLayout>
    </RelativeLayout>
    <!-- buttons bottom middle -->
    <Button
        android:id="@+id/m_oMain_Button_Contact"
        android:tag="@integer/main_tag_contact"
        style="@style/ButtonMain"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/m_oMain_Logo"
        android:layout_alignRight="@+id/m_oMain_Title"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="20dp"
        android:paddingBottom="@dimen/button_padding_vertical"
        android:paddingLeft="@dimen/button_padding_horizontal"
        android:paddingRight="@dimen/button_padding_horizontal"
        android:paddingTop="@dimen/button_padding_vertical"
        android:text="@string/contact"
        android:textColor="@color/black"
        android:textSize="@dimen/font_size_20"
        android:onClick="OnClick"/>
    <Button
        android:id="@+id/m_oMain_Button_Search"
        android:tag="@integer/main_tag_search"
        style="@style/ButtonMain"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/m_oMain_Button_Contact"
        android:layout_alignRight="@+id/m_oMain_Button_Contact"
        android:layout_above="@+id/m_oMain_Button_Contact"
        android:layout_marginBottom="20dp"
        android:paddingBottom="@dimen/button_padding_vertical"
        android:paddingLeft="@dimen/button_padding_horizontal"
        android:paddingRight="@dimen/button_padding_horizontal"
        android:paddingTop="@dimen/button_padding_vertical"
        android:text="@string/search"
        android:textColor="@color/black"
        android:textSize="@dimen/font_size_20"
        android:onClick="OnClick"/>
    <RelativeLayout
        android:id="@+id/m_oMain_Wait_Layout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@color/black_50"
        android:onClick="OnClick">
    </RelativeLayout>
    <RelativeLayout
        android:id="@+id/m_oMain_ProgressBar_Layout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@color/black_50"
        android:onClick="OnClick"
        android:visibility="invisible">     
        <ProgressBar
            android:id="@+id/m_oMain_ProgressBar"
            style="?android:attr/progressBarStyleLarge"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerHorizontal="true"
            android:layout_centerVertical="true" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_above="@+id/m_oMain_ProgressBar"
            android:layout_marginBottom="20dp"
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp"
            android:gravity="center"
            android:text="@string/main_db_init"
            android:textColor="@color/white"
            android:textSize="@dimen/font_size_20"
            android:textStyle="bold" />
    </RelativeLayout>
</RelativeLayout>

所以我的问题是,这是编辑器的错误(因为在以前的版本中它工作得很好,手机也显示正确的布局)还是我的某种布局问题。

4

0 回答 0