我对你的问题的理解.
我的回答是
>长按“编辑文本”可以打开弹出窗口.
>将编辑文本文本复制到弹出窗口 – 编辑文本.
>按“确定”将弹出窗口编辑文本的文本复制回基本文本框.
附上代码供您参考
弹出窗口xml –
android:id="@+id/LinearLayout1"
android:layout_width="250dp"
android:layout_height="250dp"
android:background="#FFFFE0"
android:orientation="vertical"
android:paddingLeft="7dip"
android:paddingTop="7dip"
android:paddingRight="7dip"
android:paddingBottom="7dip">
android:id="@+id/edit_pop"
android:layout_width="match_parent"
android:layout_height="120dp"
android:ems="10"/>
android:id="@+id/btok"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="OK" />
主要活动 –
public class MainActivity extends Activity implements OnLongClickListener
{
EditText vedt=null,edPop;
Button btOk=null;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
vedt = (EditText) findViewById(R.id.editText1);
vedt.setOnLongClickListener(this);
}
@Override
public boolean onLongClick(View v)
{
LayoutInflater layoutInflater = (LayoutInflater)getBaseContext().getSystemService(LAYOUT_INFLATER_SERVICE);
View popupView = layoutInflater.inflate(R.layout.popup, null);
final PopupWindow popupWindow = new PopupWindow(popupView,android.view.ViewGroup.LayoutParams.WRAP_CONTENT,android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
edPop = (EditText)popupView.findViewById(R.id.edit_pop);
btOk = (Button)popupView.findViewById(R.id.btok);
edPop.requestFocus();
edPop.setText(vedt.getText().toString());
popupWindow.showAtLocation(popupView, Gravity.CENTER,5,5);
popupWindow.setOutsideTouchable(false);
popupWindow.setFocusable(true);
popupWindow.update();
btOk.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
vedt.setText(edPop.getText().toString());
popupWindow.dismiss();
}
});
return false;
}
}