我正在开发一个Android应用程序,我正在弹出一个弹出窗口,我正在放置一个编辑文本但是当我运行应用程序并点击编辑文本键盘时没有显示..我在这里看到一些建议但是不起作用对我而言是我的代码
pop.xml
<EditText
android:id="@+id/et_promo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:inputType="number"
android:visibility="gone"
android:textSize="24sp">
</EditText>
活动
final View popUpView = getActivity().getLayoutInflater().inflate(R.layout.popup_add_money_wallet,
null); // inflating popup layout
mpopup = new PopupWindow(popUpView, Toolbar.LayoutParams.MATCH_PARENT,
Toolbar.LayoutParams.MATCH_PARENT, true); // Creation of popup
mpopup.setAnimationStyle(android.R.style.Animation_Dialog);
mpopup.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
mpopup.showAtLocation(popUpView, Gravity.CENTER, 0, 0); // Displaying popup
mpopup.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
ImageView mCloseIcon = (ImageView) popUpView.findViewById(R.id.close_ic);
Button btn_pb = (Button)popUpView.findViewById(R.id.btn_pb);
Button btn_hdfc = (Button)popUpView.findViewById(R.id.btn_hdfc);
Button btn_cc = (Button) popUpView.findViewById(R.id.btn_cc);
TextView tv_promo=(TextView)popUpView.findViewById(R.id.tv_promo);
final EditText et_promo = (EditText)popUpView.findViewById(R.id.et_promo);
final Button btn_promo =(Button)popUpView.findViewById(R.id.btn_promo);
final EditText tvWalletBalance = (EditText) popUpView.findViewById(R.id.tv_wallet_balance);
tv_promo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
et_promo.setVisibility(View.VISIBLE);
btn_promo.setVisibility(View.VISIBLE);
}
});
请有人告诉我如何在popup上显示edittext的键盘
答案 0 :(得分:0)
从代码中删除以下行应解决问题:
mpopup.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);