2016-05-20 6 views

答えて

1

あなたはPopupWindowを使用して、popupWindow.showAsDropDown(theView)を使用することができます。

編集:ここでは は私のコードの例です:

LayoutInflater inflater = (LayoutInflater) TimeCheckActivity.this 
      .getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
    View layout = inflater.inflate(R.layout.timecheck_popup, 
      (ViewGroup) findViewById(R.id.popup_element)); 
    popupWindow = new PopupWindow(layout, 320, 160, true); 
    popupWindow.setBackgroundDrawable(new BitmapDrawable()); 
    popupWindow.setOutsideTouchable(true); 

    radioButton[1].setOnTouchListener(new View.OnTouchListener() { 
     @Override 
     public boolean onTouch(View v, MotionEvent event) { 
      if(times.size()>1) { 
       popupText.setText(times.get(1).toString()); 
       popupWindow.showAsDropDown((View) radioButton[1]); 

      } 
      return true; 
     } 
    }); 

私ものTextView( "popupText")を持つXMLレイアウトを持っています。

+0

動作していません。リンクやコードを共有できますか? –

+0

@SagarGangawane私は自分の答えを編集しました。それを確認してください。 –

+0

それは働いてくれてありがとう。 –

関連する問題