2
A
回答
4
你應該去Android的QuickAction部件。
這是GitHub上的一個開源項目。
https://github.com/lorensiuswlt/NewQuickAction3D
https://github.com/alhneiti/Android-QuickAction
希望這會幫助你。
1
我已經achived使用PopUpWindow
這種行爲,這裏是我的代碼:
// The method that displays the popup.
private void showStatusPopup(final Activity context, Point p) {
// Inflate the popup_layout.xml
LinearLayout viewGroup = (LinearLayout) context.findViewById(R.id.llStatusChangePopup);
LayoutInflater layoutInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View layout = layoutInflater.inflate(R.layout.status_popup_layout, null);
// Creating the PopupWindow
changeStatusPopUp = new PopupWindow(context);
changeStatusPopUp.setContentView(layout);
changeStatusPopUp.setWidth(LinearLayout.LayoutParams.WRAP_CONTENT);
changeStatusPopUp.setHeight(LinearLayout.LayoutParams.WRAP_CONTENT);
changeStatusPopUp.setFocusable(true);
// Some offset to align the popup a bit to the left, and a bit down, relative to button's position.
int OFFSET_X = -20;
int OFFSET_Y = 50;
//Clear the default translucent background
changeStatusPopUp.setBackgroundDrawable(new BitmapDrawable());
// Displaying the popup at the specified location, + offsets.
changeStatusPopUp.showAtLocation(layout, Gravity.NO_GRAVITY, p.x + OFFSET_X, p.y + OFFSET_Y);
}
和這是彈出式佈局:
<?xml version="1.0" encoding="utf-8"?>
<ImageView
android:layout_marginLeft="11dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/devider_popup_task_status_change"
android:contentDescription="@drawable/devider_popup_task_status_change"/>
<TextView
android:id="@+id/tvInProgress"
android:paddingLeft="10dp"
android:layout_weight="1.0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/my_black"
android:gravity="center_vertical"
android:clickable="true"
android:onClick="popupStatusChangeOnClick"
android:layout_marginLeft="11dp"
android:layout_marginRight="4dp"
android:text="@string/inprogress"/>
<ImageView
android:layout_marginLeft="11dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/devider_popup_task_status_change"
android:contentDescription="@drawable/devider_popup_task_status_change"/>
<TextView
android:id="@+id/tvOnTheWay"
android:paddingLeft="10dp"
android:layout_weight="1.0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/my_black"
android:gravity="center_vertical"
android:clickable="true"
android:onClick="popupStatusChangeOnClick"
android:layout_marginLeft="11dp"
android:layout_marginRight="4dp"
android:text="@string/ontheway"/>
<ImageView
android:layout_marginLeft="11dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/devider_popup_task_status_change"
android:contentDescription="@drawable/devider_popup_task_status_change"/>
<TextView
android:id="@+id/tvComplete"
android:paddingLeft="10dp"
android:layout_weight="1.0"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/my_black"
android:gravity="center_vertical"
android:clickable="true"
android:onClick="popupStatusChangeOnClick"
android:layout_marginLeft="11dp"
android:layout_marginRight="4dp"
android:text="@string/complete"/>
<ImageView
android:layout_marginLeft="11dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/devider_popup_task_status_change"
android:contentDescription="@drawable/devider_popup_task_status_change"/>
<TextView
android:id="@+id/tvFailed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:layout_weight="1.0"
android:gravity="center_vertical"
android:clickable="true"
android:onClick="popupStatusChangeOnClick"
android:layout_marginLeft="11dp"
android:layout_marginRight="4dp"
android:layout_marginBottom="11dp"
android:text="@string/failed"
android:textColor="@color/my_black" />
當時ImageView
的只有1個像素的deviders。
0
你可以使用微調須─
String[] branch={"NEW","prev",...};
ArrayAdapter<String> list;
spinner=(Spinner) findViewById(R.id.spinner);
list=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,branch);
spinner.setAdapter(list);
spinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
}
0
什麼你問的是一個Spinner,但你也可以自己製作彈出的列表中,使用「ListPopupWindow」
相關問題
- 1. 在單擊可點擊列表時顯示列表視圖項選項
- 2. 列表視圖不顯示在面板
- 3. 如何在單擊列表視圖時顯示警報對話
- 4. 單擊按鈕時顯示列表視圖:Android
- 5. 如何通過單擊按鈕來顯示列表視圖?
- 6. 單擊圖像顯示錶
- 7. 單擊列表視圖中的按鈕而不單擊列表視圖(WINRT/Metro)
- 8. 顯示列表視圖列明智和按鈕點擊顯示相同的列表視圖在rowwise
- 9. 檢測內部列表視圖和顯示上下文菜單
- 10. 如何在android中顯示列表視圖的下面的頁面導航?
- 11. 如何在列表視圖上顯示文本時點擊列表視圖android
- 12. 顯示在列表視圖
- 13. 列表視圖不顯示
- 14. 顯示列表到視圖
- 15. 列表視圖不顯示
- 16. 顯示列表視圖
- 17. 列表視圖下面的列表視圖android
- 18. 在高圖表系列的右鍵單擊上顯示上下文菜單
- 19. 單擊列表視圖後顯示帶按鈕和Edittext的迷你表格
- 20. 如何使用arraylist在列表視圖的項目上單擊時顯示列表視圖?
- 21. 單擊突出顯示錶格視圖單元格
- 22. 單擊列表後的顯示吐司
- 23. 如何顯示按鈕上的列表視圖點擊相同的頁面?
- 24. 以列表視圖的形式顯示示例下載
- 25. 如何在Android中顯示特定視圖下方的下拉列表視圖?
- 26. 數據僅在桌面視圖中單擊時顯示
- 27. 在視圖中單擊下拉列表來更新mysql表格
- 28. 在顯示列表視圖的同時下載圖像
- 29. 按鈕下面的列表不顯示
- 30. 單擊/輸入時顯示組合框的下拉列表?
其實際微調發布您的代碼 – DjHacktorReborn 2013-03-11 14:48:09