2

ここに画像の説明を入力してください

このビューを作成するにはどうすればよいですか。スピナーとポップアップウィンドウを確認しましたが、失敗しました...例を教えてください...

4

4 に答える 4

4

Android QuickAction ウィジェットを使用する必要があります。

垂直クイックアクション

ここに画像の説明を入力

これは GithUb のオープン ソース プロジェクトです。

https://github.com/lorensiuswlt/NewQuickAction3D

https://github.com/alhneiti/Android-QuickAction

これがあなたを助けることを願っています。

于 2013-03-11T15:03:31.130 に答える
1

あなたが求めているのはSpinnerですが、「 ListPopupWindow」を使用して独自のポップアップ リストを作成することもできます。

于 2014-04-22T11:18:52.410 に答える
1

を使用してこの種の動作を実現しました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 ピクセルのデバイダーのみの場合。

于 2013-03-11T14:49:22.273 に答える
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) {
                        }
于 2013-03-11T15:34:38.503 に答える