我有一个简单的应用程序,它基本上由一行按钮和一个要选择和操作的项目的ListView组成。列表中可能只有一个项目或少数项目。但是,我更喜欢列表是否会从ListView的底部填充,因为大多数人拿着手机的方式可以更容易地选择靠近屏幕底部的项目。这可能吗?
答案 0 :(得分:120)
您可以使用简单的XML属性让ListView
从下到上堆叠其项目
在xml下 -
<ListView
android:stackFromBottom="true"
...
></ListView>
请阅读@The Berga的回答,否则这将无效。
答案 1 :(得分:18)
Joe的答案是正确的,但重要的是要指出只有protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration)
{
// Handle constructor parameters.
registration.Preparing += OnComponentPreparing;
// Handle properties.
registration.Activated += (sender, e) => InjectLoggerProperties(e.Instance);
}
的宽度和高度设置为ListView
或match_parent
才有效
如果设置为fill_parent
,它仍然会从上到下填充。
答案 2 :(得分:0)
我使用android:stackFromBottom="true"
尝试了android:layout_width="match_parent"
android:layout_height="fill_parent"
,但它没有工作
终于
Adapter.insert(post,0);
救了我的一天。这里的帖子是返回要添加的数据的类
答案 3 :(得分:0)
这些是必须标记,用于反向填充列表视图。
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:stackFromBottom="true"
</ListView>