我有一个应用程序,其中一个选项卡有一个任务列表。我的意图是,当我点击该列表的其中一个元素时,我希望看到该任务的详细信息。是否可以在同一页面查看该任务的列表和详细信息?我使用Eclipse。Android上的主细节布局
1
A
回答
0
您可以自己编写代码,通过浏览视图及其可见性/大小。 或者你可以使用碎片:http://developer.android.com/guide/topics/fundamentals/fragments.html
0
你可以打开一个PopupWindow
对列表视图项目单击并显示所选项目的详细信息。开放的项目一个PopupWindow
点击see
0
如果由于某种原因,你不想使用片段(例如,你不会永远被再次使用这个观点),你也可以做到这一点 - 容易和简单:
这将是你的分屏布局splitscreen.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/task_list_wrap"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="2dp" >
<ListView
android:id="@+id/task_list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:overScrollMode="never" >
</ListView>
</LinearLayout>
<LinearLayout
android:id="@+id/task_details"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:id="@+id/task_details_description"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="this is description text" />
</LinearLayout>
</LinearLayout>
而在你行动的任务列表中点击这样的时候你会改变任务的详细信息面板的内容:
setContentView(R.layout.splitscreen);
ListView taskList= (ListView) findViewById(R.id.task_list);
TextView taskDescription = (TextView) findViewById(R.id.task_details_description);
taskList.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
int selectedTask = position;
updateTaskDescription(selectedTask, taskDescription);
}
});
相关问题
- 1. Android主题细节
- 2. 撷取布局细节
- 3. Android 2.3上的主/细节流模板
- 4. Windows 10中主/细节视图的自适应布局UWP
- 5. Android主细节指南
- 6. 更新细节布局的片段
- 7. 刷新Android主/从细节部分详细流程的主页
- 8. ActionBar选项卡和主详细布局
- 9. 主细节CRUD
- 10. EF6主细节
- 11. RESTful主/细节
- 12. XSL主/细节
- 13. Android主布局模板
- 14. Android布局主题造型
- 15. android主控细节模板。如何将主数据传递到静态细节
- 16. 操纵面部细节的画布上
- 17. 主细节流Android动画API
- 18. 如何使用主/细节流与Android上的选项卡
- 19. 如何在Android上实现嵌套的主细节流?
- 20. 主/细节行为
- 21. 主细节CONTROLL不
- 22. Android上的网格布局?
- 23. 布局Android honeycomb上的activatedBackgroundIndicator
- 24. Android布局上的NullPointer?
- 25. Android上的网页布局
- 26. 布局上的Android动画
- 27. Playbook上的Android FileSystem布局
- 28. Grid.Mvc的主细节行
- 29. 使用JTable的主细节
- 30. Android的布局 - 像布局
最好的解决方案是使用碎片http://developer.android.com/guide/topics/fundamentals/fragments.html – 2012-04-03 09:34:42