安卓:滚动preferences窗口自定义列表视图 [英] Android: Scrollable preferences window with custom list view

查看:112
本文介绍了安卓:滚动preferences窗口自定义列表视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有与被填充从XML文件preferences,那么另一个的ListView得到由数据填充在我的数据库,然后一个TextView和EditText上一个ListView的活动。

I have an activity with a listview that gets populated with preferences from an xml file, then another listview that gets populated by data in my database, then a textview and a edittext.

我想在屏幕上的每一个元素(包括所有的列表视图)采取充分的高度,整个屏幕会滚动的,但我不知道如何做到这一点!

I want every element (including all the list views) on the screen to take their full height, and the entire screen be scrollable, but I cannot figure out how to do this!

下面是我的xml:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollView1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:fillViewport="true" >

    <LinearLayout
        android:id="@+id/llContainer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >

        <LinearLayout
            android:id="@+id/llPreferences"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <ListView
                android:id="@android:id/list"
                android:layout_width="fill_parent"
                    android:layout_height="wrap_content">
            </ListView>
        </LinearLayout>

        <LinearLayout
            android:id="@+id/llPlaces"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:weightSum="1" >

            <TextView
                android:id="@+id/textView1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="TextView"
                android:textAppearance="?android:attr/textAppearanceLarge" >
            </TextView>

            <ListView
                android:id="@+id/lstPlaces"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >
            </ListView>

            <LinearLayout
                android:id="@+id/llAddNewPlace"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical" >

                <EditText
                    android:id="@+id/txtNewPlaceName"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content" >
                </EditText>

                <Button
                    android:id="@+id/btnAddNewPlace"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="Add New" >
                </Button>
            </LinearLayout>
        </LinearLayout>
    </LinearLayout>

</ScrollView>

这是为什么不执行,因为我想和所期望的任何想法?

Any ideas why this is not performing as I want and would expect?

谢谢, 最大。

推荐答案

Similer问题与解决方案,这个THEAD:

Similer problem with solution on this thead:

Android的滚动型布局问题

不幸的是,它看起来像你不能有一个scrolllayout列表视图。

Unfortunatly it looks like you cannot have a listview in a scrolllayout.

谁的人有兴趣,看起来像一个潜在的解决方法可以在这里找到,现在无论是还是将来:

For people who are interested, looks like a potential workaround could be found here either now or in the future:

<一个href="http://stackoverflow.com/questions/4097385/listview-in-scrollview-potential-workaround">ListView在滚动型潜在的解决方法

这篇关于安卓:滚动preferences窗口自定义列表视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆