मैं ऊपर और नीचे क्षैतिज लीनियरलाउट्स के साथ एक लेआउट बनाना चाहता हूं, एक सूची दृश्य मध्य में भरें।लेआउट समस्या: ऊपर और नीचे कुछ कैसे रखें?
मैं main.xml को कैसे परिभाषित कर सकता हूं।
मैंने शीर्ष पर क्षैतिज लीनियरलाइट के साथ एक लेआउट बनाने की कोशिश की, नीचे टेक्स्टव्यू, एक सूची दृश्य मध्य में भरें; ठीक है। लेकिन जब मैंने नीचे टेक्स्टव्यू को रैखिकलायआउट में संशोधित किया, तो नीचे रैखिक लयआउट गायब हो गया।
<?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
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
>
<TextView
android:textSize="12px"
android:text="something here"
android:layout_width="50px"
android:layout_height="wrap_content"
/>
<TextView
android:textSize="12px"
android:text="something here"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom"
>
<ListView
android:id="@+id/listbody"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:textSize="12px"
android:text="50%"
/>
<TextView
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1"
android:textSize="12px"
android:text="50%"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
कोई भी सलाह दे सकता है? कृपया मदद करें।
अब लिनियरलाइट सूचीव्यू के साथ ओवरलैप हो गया है! मुझे लगता है कि यह नीचे लिनियरलाउट की परिभाषा में कुछ गलत होना चाहिए। – chow
विशेष रूप से नहीं। ListView के लिए, जोड़ें: \t एंड्रॉयड: layout_height = "wrap_content" \t एंड्रॉयड: layout_width = "fill_parent" \t एंड्रॉयड: layout_below = "@ आईडी/top_linear_layout_id" \t एंड्रॉयड: layout_above = "@ + id/bottom_linear_layout_id" रैखिक लेआउट के लिए संबंधित आईडी के साथ। – Estel