所以,match_parent 替换了 fill_parent。我发现了这个由 Romain Guy 回答的问题。
结合父级的 wrap_content 和子级的 fill_parent
他说这不应该起作用,但他们使它适用于 LinearLayout,并且他最近使它适用于 Honeycomb 的 FrameLayout。
基于此,我推测这可能不适用于RelativeLayout?
尝试使用 LinearLayout 或 FrameLayout 而不是 RelativeLayout 看看是否可行?
编辑这是我所做的:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<FrameLayout
android:layout_height="wrap_content"
android:layout_width="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button
android:layout_height="match_parent"
android:layout_width="match_parent"
android:text="TEST"/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
字符串的值:
<string name="hello">Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game! Hello World, Game!</string>