我有以下XML爲什麼我的relativeLayout不會出現在它的兄弟linearLayout之下?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/blue_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical" >
<com.my.view.text.MyTextView
android:id="@+id/whyResgisterHeaderText"
style="@style/textOnBg"
android:layout_marginTop="25dp"
android:text="WHY REGISTER?"
android:textStyle="bold" />
<com.my.view.text.MyTextView
android:id="@+id/whyResgisterBodyText"
style="@style/textOnBg"
android:text="Help us keep your account safe"
android:textStyle="normal" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_marginTop="5dp"
android:src="@drawable/signup_illu_why" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center" >
<Button
android:id="@+id/gotItButton"
android:layout_width="250dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:background="@drawable/btn_selector"
android:padding="0dp" />
<com.my.view.text.MyTextView
android:id="@+id/gotItText"
style="@style/textOnBg"
android:layout_marginTop="25dp"
android:text="Got it"
android:textColor="#00bcfe"
android:textSize="16dp"
android:textStyle="italic" />
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical" >
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#70a5b3" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<com.my.view.text.MyTextView
style="@style/textOnBg"
android:layout_toLeftOf="@+id/skipIcon"
android:text="Skip"
android:textStyle="normal" />
<ImageView
android:id="@id/skipIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/signup_skip_icon" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
我想我的屏幕看起來像:
但它看起來像:
1)爲什麼我不能請參閱fotter relativeLayout(使用「跳過」)
2)我怎麼能中心gotItText
textView?爲什麼它不是以當前屬性爲中心?
在我的IDE中,如果我將自定義的TextView更改爲默認的TextView並刪除所有樣式,它將按照您的要求工作。 –
嘗試通過xml,並檢查RelativeLayout的佈局高度屬性,即「wrap_content」,它是子LinearLayout(其中包括「skip」具有alignParent)。這本身就是矛盾的。將頂部RelativeLayout的屬性設置爲「match_parent」。讓我知道,如果這個作品! –