Reputation: 3381
I have a layout which starts with an include to another layout and right after that there is a LinearLayout with two buttons in it.
The problem is that I don't see the layout with the two buttons after I added the include. But when I wrap the include with another layout, I do see the two buttons below the include and the problem is solved.
Can someone please tell me why I have to wrap the include?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<include
android:id="@+id/keypad_layout"
layout="@layout/keypad_layout" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/buttonAudio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_audio_selector" />
<Button
android:id="@+id/buttonVideo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_video_selector" />
</LinearLayout>
</LinearLayout>
Upvotes: 0
Views: 43
Reputation: 13327
try this
<include
android:layout_height="wrap_content"
android:id="@+id/keypad_layout"
layout="@layout/keypad_layout" />
perhaps the layout_height
in keypad_layout
root is match_parent
so override it in the include
Upvotes: 1