I tried to make a simple layout like so
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="hello" />
</LinearLayout>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="world" />
</LinearLayout>
Only the first TextView ("hello") is displayed. What am I doing wrong?
Make layout_height
of inner layout wrap_content
.
Your second LinearLayout
is set to fill_parent
in the layout's height. This is causing it to push out everything that's below it that was placed into the first LinearLayout
. Change it to wrap_content
and it should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With