我有一個應用程序,其中一個選項卡有一個任務列表。我的意圖是,當我點擊該列表的其中一個元素時,我希望看到該任務的詳細信息。是否可以在同一頁面查看該任務的列表和詳細信息?我使用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