-1
我有一个列表视图与每个列表项目包含两个Edittext视图。我需要显示一个图像作为信息窗口上的EditText当第一次打开屏幕,并删除,如果用户点击屏幕上的任何地方。我不能明白我怎么把这种形象略高于edittext.For参考我附上下面的屏幕:如何在列表视图中将edit图像显示为信息窗口?
请指导我如何可以放置图像的第一列表项的EditText。
我有一个列表视图与每个列表项目包含两个Edittext视图。我需要显示一个图像作为信息窗口上的EditText当第一次打开屏幕,并删除,如果用户点击屏幕上的任何地方。我不能明白我怎么把这种形象略高于edittext.For参考我附上下面的屏幕:如何在列表视图中将edit图像显示为信息窗口?
请指导我如何可以放置图像的第一列表项的EditText。
您应该使用自定义对话框屏幕上的特定位置。每当用户第一次打开对话框时都会显示。
public static void shiftMessageDialog(Activity context, String message,
int theme) {
// custom dialog
final Dialog dialog = new Dialog(context);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.shift_message_dialog);
RelativeLayout rv = (RelativeLayout) dialog.findViewById(R.id.rv);
// set the custom dialog components - text
TextView messageTxt = (TextView) dialog.findViewById(R.id.message_txt);
messageTxt
.setText("Remember to close up the store and we have training at 10am");
dialog.show();
}
您可以使用PopupWindow
来达到此目的。
代码段
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View popUpView = inflater.inflate(R.layout.pop_up, null, false);
Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.select_dropdown);
popupWindowProperty = new PopupWindow(popUpView, anchorView.getWidth(),
300, true);
popupWindowProperty.setContentView(popUpView);
popupWindowProperty.setBackgroundDrawable(new BitmapDrawable(getResources(),
bitmap));
popupWindowProperty.setOutsideTouchable(true);
popupWindowProperty.setFocusable(true);
popupWindowProperty.showAsDropDown(anchorView, 0, 0);
你可以用'seterror'方法这一点。 – Shvet 2014-12-08 06:54:01