У меня есть макет с несколькими текстовыми полями и флажками. Между ними есть listview. Когда я добавляю три или несколько элементов, я не вижу их в списке, в списке нет полосы прокрутки.Невозможно прокрутить список элементов списка
Это мой макет:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text" />
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text" />
<EditText
android:id="@+id/editText2"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text" />
<EditText
android:id="@+id/editText3"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text" />
<EditText
android:id="@+id/editText4"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="163dp"
android:orientation="horizontal" >
<!-- -------------HERE IS MY LISTVIEW--------------- -->
<ListView
android:id="@+id/listView"
android:layout_width="wrap_content"
android:layout_height="fill_parent" />
</LinearLayout>
<LinearLayout
android:id="@+id/linearLayoutCheckBox"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/linearLayoutGlavni"
android:layout_below="@+id/linearLayoutGlavni"
android:layout_weight="1"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/checkBox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Reklamacija dobavljaču" />
<CheckBox
android:id="@+id/checkBox2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="14dp"
android:layout_toRightOf="@+id/checkBox"
android:text="Prenamjena robe" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/checkBox3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Otpis robe" />
<CheckBox
android:id="@+id/checkBox4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="111dp"
android:layout_toRightOf="@+id/checkBox3"
android:text="Upozorenje djelatniku" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/checkBox5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Obuka djelatnika" />
<CheckBox
android:id="@+id/checkBox6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="64dp"
android:layout_toRightOf="@+id/checkBox5"
android:text="Održavanje" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:weightSum="1" >
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text" />
<EditText
android:id="@+id/editText5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.68" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
Есть ли что-то отсутствует в коде макета или это должно быть решено с помощью кода?
Компоновка вы вывесили не содержит 'ListView', но что более важно, это даже не действует ... –
Он содержит, Я проверил. – Josef
Я вижу, как должен выглядеть этот макет? Честно говоря, весь этот xml выглядит сумасшедшим с множеством ненужных представлений. Это может быть значительно упрощено. Но, как я уже сказал. Это недопустимо xml. Пожалуйста, исправьте это. И ваш 'ListView' помещен в' ScrollView', который не будет работать. Вложенные прокручиваемые элементы невозможно в Android. –