您好,我正在开始 Android 开发。我只是用 ECLIPSE 修改一个开源示例。我只修改了 strings.xml 和一些 .png 文件。在 Android 模拟器中,它运行完美,但是当我尝试生成签名的 apk 文件时,我收到两个描述相似的错误。这是其中之一(该行用 * 标记):
说明@+id/about_us_desc_webview在同一个RelativeLayout cc3x_about_us.xml中不是兄弟
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
style="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/grey_background"
android:orientation="vertical" >
<include
android:id="@+id/cc3x_about_header_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
layout="@layout/cc3x_headerlayout" />
<TextView
android:id="@+id/about_us_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cc3x_about_header_view"
android:layout_centerHorizontal="true"
android:layout_marginTop="@dimen/about_title_label_top_margin"
android:text="@string/about_us_label"
android:textColor="@color/grey_text_color"
android:textSize="@dimen/extra_large_text_size"
android:textStyle="bold" />
<View
android:id="@+id/view1"
android:layout_width="fill_parent"
android:layout_height="@dimen/min_divider_height"
android:layout_below="@+id/about_us_textview"
android:layout_marginLeft="@dimen/about_title_label_side_margin"
android:layout_marginRight="@dimen/about_title_label_side_margin"
android:background="@drawable/about_page_divline" />
<WebView
android:id="@+id/about_us_desc_webview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/view1"
android:layout_marginLeft="@dimen/about_title_label_side_margin"
android:layout_marginRight="@dimen/about_title_label_side_margin"
android:layout_marginTop="@dimen/min_margin_cutoff" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/about_us_desc_webview" >
<TextView
android:id="@+id/about_screen_contact_label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
* android:layout_below="@+id/about_us_desc_webview"
android:layout_centerHorizontal="true"
android:text="@string/contact_label"
android:textColor="@color/grey_text_color"
android:textSize="25dip"
android:textStyle="bold" />
<View
android:id="@+id/divider_bottom"
android:layout_width="match_parent"
android:layout_height="@dimen/min_divider_height"
android:layout_below="@+id/about_screen_contact_label"
android:layout_marginLeft="@dimen/about_title_label_side_margin"
android:layout_marginRight="@dimen/about_title_label_side_margin"
android:background="@drawable/about_page_divline" />
<TextView
android:id="@+id/about_xcube_link"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/divider_bottom"
android:layout_margin="@dimen/max_margin_size"
android:autoLink="web"
android:text="@string/xcube_url"
android:textColor="@color/blue_text_color"
android:textColorLink="@color/blue_text_color"
android:textSize="10dip" />
<TextView
android:id="@+id/about_xcube_contact_email"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/divider_bottom"
android:layout_margin="@dimen/max_margin_size"
android:autoLink="email"
android:text="@string/xcube_contact_email"
android:textSize="@dimen/small_text_height" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/about_xcube_link"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="@string/about_xcube_address"
android:textColor="@color/grey_text_color"
android:textSize="@dimen/small_text_height" />
</RelativeLayout>
</RelativeLayout>
我们将不胜感激任何帮助。非常感谢!!
最佳答案
线
android:layout_below="@+id/about_us_desc_webview"
在您的 TextView 中是多余的。由于 RelativeLayout 已经具有该属性,因此它是无用的。您可以只删除该行,不会有任何改变。
它产生错误的原因是,您可以在同一布局中对元素应用诸如下方、上方等功能。这里“about_us_desc_webview”在 RelativeLayout 之外,您不能将某些东西放在 RelativeLayout 内部,而某些东西放在 RelativeLayout 外部。
关于android - 不是同一 RelativeLayout 中的同级,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25527973/