あなたは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レイアウトを持っています。
動作していません。リンクやコードを共有できますか? –
@SagarGangawane私は自分の答えを編集しました。それを確認してください。 –
それは働いてくれてありがとう。 –