[英]is not a sibling in the same RelativeLayout
你好,我開始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中定位。
將此視圖的上邊緣定位在給定錨點視圖ID下方。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/colorWhite"
android:id="@+id/rl_rootHeader"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/rl_Header"
android:layout_below="@+id/rl_rootHeader" // Arise ,In here RelativeLayout is Parent .
>
//
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:fillViewport="true"
android:id="@+id/scrollRoot"
android:background="@color/colorWhite"
>
</ScrollView>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/colorWhite"
android:id="@+id/rl_rootHeader"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/rl_Header"
>
//
</RelativeLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:fillViewport="true"
android:id="@+id/scrollRoot"
android:background="@color/colorWhite"
android:layout_below="@+id/rl_rootHeader" // Call Here .This section is Child
>
</ScrollView>
如果轉到“屬性”面板,您將看到布局:alignComponent的某些對齊方式顯示為“未找到”。 把它清理干凈吧。 在上面的示例屬性窗口 - > textview - > layout:alignComponent中檢查所有對齊值。
只需從布局.xml文件中刪除導致錯誤的行
嘗試刷新布局
你的布局可能會改變。 您現在可以正確重置它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.