두 개의 선형 레이아웃을 다른 선형 레이아웃의 직접 하위로 중첩하려고합니다. 결국이 두 레이아웃이 ViewFlipper 내에 중첩되어 두 개의 선형 레이아웃이 화면 안팎으로 바뀌게됩니다.직접 네 스팅 선형 레이아웃은 첫 번째 자식 뷰만 표시합니다.
레이아웃이 표시되는 케이스 첫 아이만을 처음 위젯 I 둥지 부모 요소 내에서 두 개의 선형 레이아웃까지 잘 작동합니다. 그래서 저는 다음과 같은 것을 가지고 있습니다 :
<LinearLayout (parent)...
<LinearLayout (child1)...
<child1's Widgets... <---only the first widget here is being shown
<LinearLayout (child2)...
<child2's widgets...
나는 이것이 어떻게 일어날 수 있는지 잘 모릅니다. 아무도 어떤 빛을 흘릴 수 있습니까 ??
전체 코드 :
<?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"
android:background="#FFFFFF">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="22sp"
android:layout_gravity="center"
android:gravity="center"
android:text="Hello, is this a great app?"
android:textColor="#000000"
android:layout_marginBottom="10dip"
android:layout_marginTop="8dip"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/btnYes"
android:text="Yes"
android:textSize="20sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginBottom="7dip"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"/>
<Button
android:id="@+id/btnNo"
android:text="No"
android:textSize="20sp"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginBottom="7dip"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"/>
</LinearLayout>
<!-- <ViewFlipper
android:layout_width="fill_parent"
android:layout_height="fill_parent">
-->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout <!-- ONLY THE CONTENT FROM HERE IS BEING SHOWN -->
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0px"
android:layout_height="wrap_content"
android:text="Lat:"
android:textSize="16sp"
android:layout_weight="1"
android:layout_marginLeft="12dip"/>
<TextView
android:id="@+id/lblLat"
android:layout_width="0px"
android:layout_height="wrap_content"
android:text=""
android:textSize="16sp"
android:layout_weight="3"
android:gravity="right"
android:layout_marginRight="12dip"/>
</LinearLayout> <!--NO MORE CONTENT Is SHOWN AFTER HERE -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0px"
android:layout_height="wrap_content"
android:text="Lon:"
android:textSize="16sp"
android:layout_weight="1"
android:layout_marginLeft="12dip"/>
<TextView
android:id="@+id/lblLon"
android:layout_width="0px"
android:layout_height="wrap_content"
android:text=""
android:textSize="16sp"
android:layout_weight="3"
android:gravity="right"
android:layout_marginRight="12dip"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0px"
android:layout_height="wrap_content"
android:text="Number of satellites:"
android:textSize="16sp"
android:layout_weight="3"
android:layout_marginLeft="12dip"/>
<TextView
android:id="@+id/lblSats"
android:layout_width="0px"
android:layout_height="wrap_content"
android:text=""
android:textSize="16sp"
android:layout_weight="1"
android:gravity="right"
android:layout_marginRight="12dip"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="0px"
android:layout_height="wrap_content"
android:text="Signal To Noise:"
android:textSize="16sp"
android:layout_weight="3"
android:layout_marginTop="25dip"
android:layout_marginLeft="12dip"/>
<TextView
android:id="@+id/lblSNR"
android:layout_width="0px"
android:layout_height="wrap_content"
android:text=""
android:textSize="16sp"
android:layout_weight="1"
android:gravity="right"
android:layout_marginTop="25dip"
android:layout_marginRight="12dip"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/lblAddresses"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
android:textSize="16sp"
android:layout_marginLeft="12dip"
android:minLines="3"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/lblAbout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Stuff About App"
android:textSize="16sp"
android:layout_marginLeft="12dip"
android:minLines="3"/>
</LinearLayout>
<!-- </ViewFlipper> -->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/btnLookup"
android:text="LookUp"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="20dip"
android:paddingTop="1dip"
android:paddingBottom="5dip"
android:layout_alignParentBottom="true"
android:layout_marginBottom="8dip"
android:layout_marginLeft="8dip" />
<Button
android:id="@+id/btnQuit"
android:text="Quit"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:padding="20dip"
android:paddingTop="1dip"
android:paddingBottom="5dip"
android:layout_marginBottom="8dip"
android:layout_marginRight="8dip" />
</RelativeLayout>
</LinearLayout>
XML 샘플의 문제를 일으키는 선형 레이아웃을 지적 할 수 있습니까? – hooked82
안녕하세요. 편집 된 코드에 주석이 있습니다. –
XML의 주요 부분에 ScrollView를 래핑하면 어떻게됩니까? 콘텐츠가 화면에 비해 너무 길어서 스크롤하지 않으면 콘텐츠가 표시되지 않습니다. – hooked82