【发布时间】:2013-01-04 10:51:08
【问题描述】:
首先 - 我知道,我不应该将 ListView 放入 ScrollView,因为 ListView 负责自己的垂直滚动。
无论如何,在我的情况下它是不同的 - 问题:
我有一个视图,其中显示了一些信息,也有一些操作。 这是一个示例屏幕:
Email1 是放置在 ListView 中的 ListItem。 Homepage 也是放置在第二个 ListView 中的 ListItem。 (我使用 ListViews,因为我无法像使用 ListItem 和 ListViews 那样设置按钮样式 - 另一个原因是,我可以显示 Second Mail: Email2 if exists)
无论如何。现在的问题是,布局看起来像这样:
<ScrollView>(父)--> <LinearLayout>(子父)--> <LinearLayout>-->((它描述了电子邮件,或“Sonstiges”,与主页)--> @987654327 @(这里是 ListView)..
我遇到的问题是,当使用 ScrollView 时,它会切掉第二个元素,我看不到它,看这里:
在这里,我用黄色标记了它,是我可以点击 ListItem 的地方。它只显示了一点点,甚至无法显示第三个项目:
我尝试的是删除 ScrollView。好吧,现在它向我显示了第二个项目,但是在整个视图中,我需要滚动,因为信息和操作比我在一个“页面”上看到的要多。
一些 axml(它的“Aktionen”,从屏幕上方)其余的看起来完全像这样:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
style="@style/ScrollView"
xmlns:local="http://schemas.android.com/apk/res/INMobileCRM4Android.INMobileCRM4Android"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout style="@style/LinearLayout">
<LinearLayout style="@style/LinearLayoutSmall">
<TextView
style="@style/TextAktionen"
android:text="Aktionen" />
<Mvx.MvxBindableListView
local:MvxBind="{'ItemsSource':{'Path':'ActionsList'},'ItemClick':{'Path':'ActionCommand'}}"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:cacheColorHint="#00000000"
local:MvxItemTemplate="@layout/addressshowdataactionlistitem"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
风格:
<style name="LinearLayout" parent="android:Theme">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">fill_parent</item>
<item name="android:orientation">vertical</item>
<item name="android:background">@string/backgroundPicture</item>
</style>
<style name="LinearLayoutSmall" parent="android:Theme">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:orientation">vertical</item>
</style>
<style name="ScrollView" parent="android:Theme">
<item name="android:layout_width">fill_parent</item>
<item name="android:layout_height">wrap_content</item>
</style>
ListItem 本身的 Style 并不是必需的。 我改成LinearLayout、FrameLayout、RelativeLayout,都是一样的。
希望有人能帮帮我..
【问题讨论】:
-
我问了一个关于 ScrollView 和 TimePicker 的类似问题,因为 TimePicker 处理它自己的滚动。虽然没有得到任何答案。我开始担心这是我们不应该做的事情。我真的需要它在我的应用程序中,否则我的布局将是半空的。
-
虽然很奇怪...
标签: android listview layout styles scrollview