导航:首页 > 操作系统 > android自定义弹出层

android自定义弹出层

发布时间:2022-08-01 09:41:36

android设置dialog在第几层显示

android中dialog都是弹出的对话框,没有第几层这个概念,只有dialog有级别。
具体实现代码:
1.创建对象框
AlertDialog.Builder builder = new Builder(context);
builder.setTitle("请输入"); //设置对话框标题
builder.setIcon(android.R.drawable.btn_star); //设置对话框标题前的图标

2.创建EditText输入框
final EditText edit = new EditText(context);

3.将输入框赋值给Dialog,并增加确定取消按键
builder.setView(edit);
builder.setPositiveButton("确认", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(context, "你输入的是: " + edit.getText().toString(), Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(context, "你点了取消", Toast.LENGTH_SHORT).show();
}
});

4.设置常用api,并show弹出
builder.setCancelable(true); //设置按钮是否可以按返回键取消,false则不可以取消
AlertDialog dialog = builder.create(); //创建对话框
dialog.setCanceledOnTouchOutside(true); //设置弹出框失去焦点是否隐藏,即点击屏蔽其它地方是否隐藏
dialog.show();

② Android 自定义键盘点击按键出现的浮层怎样去掉

那个不是TextView是EditText,你只要把EditText放在Button上面就行了代码如下:粘进去运行就行了activity随便写个就行记得配manifest~~~

③ android使用百度地图3.0版本怎样实现自定义弹出窗口功能

基本原理就是用ItemizedOverlay来添加附加物,在OnTap方法中向MapView上添加一个自定义的View(如果已存在就直接设为可见),下面具体来介绍我的实现方法:


一、自定义覆盖物类:MyPopupOverlay,这个类是最关键的一个类ItemizedOverlay,用于设置Marker,并定义Marker的点击事件,弹出窗口,至于弹出窗口的内容,则通过定义Listener,放到Activity中去构造。如果没有特殊需求,这个类不需要做什么改动。代码如下,popupLinear这个对象,就是加到地图上的自定义View:

java"><OverlayItem>{
privateContextcontext=null;
//这是弹出窗口,包括内容部分还有下面那个小三角
=null;
//这是弹出窗口的内容部分
private
ViewpopupView=null;
privateMapViewmapView=null;
private
Projectionprojection=null;
//这是弹出窗口内容部分使用的layoutId,在Activity中设置
privateintlayoutId=
0;
//是否使用网络带有A-J字样的Marker
=
false;
privateint[]defaultMarkerIds={
R.drawable.icon_marka,
R.drawable.icon_markb,
R.drawable.icon_markc,
R.drawable.icon_markd,
R.drawable.icon_marke,
R.drawable.icon_markf,
R.drawable.icon_markg,
R.drawable.icon_markh,
R.drawable.icon_marki,
R.drawable.icon_markj,};
//这个Listener用于在Marker被点击时让Activity填充PopupView的内容
private
OnTapListeneronTapListener=null;
publicMyPopupOverlay(Contextcontext,Drawablemarker,MapViewmMapView)
{
super(marker,mMapView);
this.context=
context;
this.popupLinear=newLinearLayout(context);
this.mapView=mMapView;
popupLinear.setOrientation(LinearLayout.VERTICAL);
popupLinear.setVisibility(View.GONE);
projection=
mapView.getProjection();
}
@Override
publicbooleanonTap(GeoPointpt,MapViewmMapView)
{
//点击窗口以外的区域时,当前窗口关闭
if(popupLinear!=null&&
popupLinear.getVisibility()==View.VISIBLE){
LayoutParamslp=
(LayoutParams)popupLinear.getLayoutParams();
PointtapP=new
Point();
projection.toPixels(pt,tapP);
PointpopP
=newPoint();
projection.toPixels(lp.point,
popP);
intxMin=popP.x-lp.width/2+lp.x;
intyMin=popP.y-lp.height+lp.y;
intxMax=popP.x+
lp.width/2+lp.x;
intyMax=popP.y+lp.y;
if
(tapP.x<xMin||tapP.y<yMin||tapP.x>xMax
||tapP.y>yMax)
popupLinear.setVisibility(View.GONE);
}
return
false;
}
@Override
protectedbooleanonTap(inti){
//
点击Marker时,该Marker滑动到地图中央偏下的位置,并显示Popup窗口
OverlayItemitem=
getItem(i);
if(popupView==null){
//
如果popupView还没有创建,则构造popupLinear
if
(!createPopupView()){
returntrue;
}
}
if(onTapListener==null)
return
true;
popupLinear.setVisibility(View.VISIBLE);
onTapListener.onTap(i,popupView);
popupLinear.measure(0,0);
intviewWidth=
popupLinear.getMeasuredWidth();
intviewHeight=
popupLinear.getMeasuredHeight();
LayoutParamslayoutParams=newLayoutParams(viewWidth,
viewHeight,
item.getPoint(),0,-60,
LayoutParams.BOTTOM_CENTER);
layoutParams.mode=
LayoutParams.MODE_MAP;
popupLinear.setLayoutParams(layoutParams);
Pointp=new
Point();
projection.toPixels(item.getPoint(),p);
p.y=
p.y-viewHeight/2;
GeoPointpoint=projection.fromPixels(p.x,
p.y);
mapView.getController().animateTo(point);
return
true;
}
privatebooleancreatePopupView(){
//TODOAuto-generated
methodstub
if(layoutId==0)
return
false;
popupView=LayoutInflater.from(context).inflate(layoutId,
null);
popupView.setBackgroundResource(R.drawable.popupborder);
ImageView
dialogStyle=newImageView(context);
dialogStyle.setImageDrawable(context.getResources().getDrawable(
R.drawable.iw_tail));
popupLinear.addView(popupView);
android.widget.LinearLayout.LayoutParamslp=new
android.widget.LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT);
lp.topMargin=
-2;
lp.leftMargin=60;
popupLinear.addView(dialogStyle,
lp);
mapView.addView(popupLinear);
returntrue;
}
@Override
publicvoidaddItem(List<OverlayItem>items)
{
//TODOAuto-generatedmethodstub
intstartIndex=
getAllItem().size();
for(OverlayItemitem:items){
if(startIndex>=defaultMarkerIds.length)
startIndex=
defaultMarkerIds.length-1;
if(useDefaultMarker&&
item.getMarker()==null){
item.setMarker(context.getResources().getDrawable(
defaultMarkerIds[startIndex++]));
}
}
super.addItem(items);
}
@Override
publicvoidaddItem(OverlayItemitem){
//
TODOAuto-generatedmethodstub
//
重载这两个addItem方法,主要用于设置自己默认的Marker
intindex=
getAllItem().size();
if(index>=
defaultMarkerIds.length)
index=defaultMarkerIds.length-
1;
if(useDefaultMarker&&item.getMarker()==
null){
item.setMarker(context.getResources().getDrawable(
defaultMarkerIds[getAllItem().size()]));
}
super.addItem(item);
}
publicvoidsetLayoutId(intlayoutId){
this.layoutId=
layoutId;
}
publicvoidsetUseDefaultMarker(booleanuseDefaultMarker){
this.useDefaultMarker=useDefaultMarker;
}
publicvoidsetOnTapListener(OnTapListeneronTapListener){
this.onTapListener=onTapListener;
}
publicinterfaceOnTapListener{
publicvoidonTap(intindex,
ViewpopupView);
}
}

二、MainActivity,这是主界面,用来显示地图,创建MyPopupOverlay对象,在使用我写的MyPopupOverlay这个类时,需要遵循以下步骤:


创建MyPopupOverlay对象,构造函数为public MyPopupOverlay(Context context, Drawable marker, MapView mMapView),四个参数分别为当前的上下文、通用的Marker(这是ItemizedOverlay需要的,当不设置Marker时的默认Marker)以及网络地图对象。

设置自定义的弹出窗口内容的布局文件ID,使用的方法为public void setLayoutId(int layoutId)。

设置是使用自定义的Marker,还是预先写好的带有A-J字样的网络地图原装Marker,使用的方法为public void setUseDefaultMarker(boolean useDefaultMarker),只有当这个值为true且没有调用OverlayItem的setMarker方法为特定点设置Marker时,才使用原装Marker。

创建Marker所在的点,即分别创建一个个OverlayItem,然后调用public void addItem(OverlayItem item)或public void addItem(List<OverlayItem> items)方法来把这些OverlayItem添加到自定义的附加层上去。

为MyPopupOverlay对象添加onTap事件,当Marker被点击时,填充弹出窗口中的内容(也就是第2条中layoutId布局中的内容),设置方法为public void setOnTapListener(OnTapListener onTapListener),OnTapListener是定义在MyPopupOverlay中的接口,实现这个接口需要覆写public void onTap(int index, View popupView)方法,其中,index表示被点击的Marker(确切地说是OverlayItem)的索引,popupView是使用layoutId这个布局的View,也就是弹出窗口除了下面的小三角之外的部分。

把这个MyPopupOverlay对象添加到地图上去:mMapView.getOverlays().add(myOverlay);mMapView.refresh();

④ 请教实现android工程中点击菜单弹出一个对话框

说下思路的,既然是弹出对话框,肯定是需要一个dialog,既然这个dialog中的一些属性是自己设定的,肯定是要设置自己自定义的dialog,怎么样才能弹出dialog呢,当你监听点击菜单的事件,记得几贴哟,逻辑很重要的,其他的就要靠你自己的了
android 点击按钮 让菜单从上面弹出
分类: 移动开发/ Android/ 文章
VC/MFC 菜单从绘,点击菜单项目发送自定义消息,弹出afxMessagebox("1");//报错

菜单自绘,点击菜单项目发送自定义消息,弹出afxMessagebox("1");//报错wm_buttondown消息里//自定义消息SendMessage发送自定义消息,报错。换成PostMessage就没事。这是啥原理? 解决方案贴相关
VC/MFC 怎么点击按钮弹出右键菜单,并且按钮保持按上状态

如何点击按钮弹出右键菜单,并且按钮保持按下状态?环境:VS2008 MFC问题:我重绘了按钮,分为3个状态:正常、鼠标进入、鼠标按下;当点击鼠标时会在按钮下面弹出右键菜单。现在问题是右键菜单弹出后,按钮的按下状态就消失了!!请问如何在弹出菜单时使按钮保持按下状态,在菜单消失时按钮状态恢复正常?解决方案你试试看设立一个
VC/MFC MDI怎么实现一个功能,菜单下点击一个按钮弹出一个ClistView

MDI如何实现一个功能,菜单上点击一个按钮弹出一个ClistView?MDI如何实现一个功能,菜单上点击一个按钮弹出一个ClistView?注意是CListView,不是弹对话框。这个功能怎么实现啊??解决方案 CDockablePane ?用VS2008SP1/VS2010建个SDI/MDI工程就看到了
Android Android点按钮弹出系统菜单的方法,该如何处理

Android点按钮弹出系统菜单的方法不点击menu按钮、点击自定义的按钮弹出系统的menu菜单如何实现、菜鸟请教、解决方案http://www.eoeandroid.com/thread-69418-1-1.html 解决方案 调用这句KeyEvent event=new KeyEvent
Delphi 小弟我想点击菜单上面的一个按钮后,直接就类式与按下了PrintScreen键,但是小弟我对键盘消息不是很清楚,大侠

我想点击菜单上面的一个按钮后,直接就类式与按下了PrintScreen键,但是我对键盘消息不是很清楚,请教各位大侠!我是这样实现的: 在按钮的单击事件里面这样写的: SendMessage(Handle,WM_KEYUP,VK_SNAPSHOT,0
Android Android 弹出菜单 - PathButton

Android 弹出菜单 ---- PathButton http://www.oschina.net/p/pathbutton
Android 点击弹出层如何处理点击到上面层

点击弹出层如何避免点击到下面层 。如在原来的列表上 放了一个隐藏显示的ReltionLayout 里面放了一些 选项 选择排序或过滤条件,这时在列表上面弹出显示这个ReltionLayout ,点击这个ReltionLayout 空白处 没有刚好点击
C++ VS2010点击菜单弹出对话框解决方案

VS2010点击菜单弹出对话框在mfc下,新建一个菜单项,然后给它加一个消息处理函数,就是弹出一个对话框的。但是,加一个消息处理函数的前提是这个菜单的Popup属性是false,可是,当popup属性是false的时候,程序运行出来那个菜单项是灰色的,根本点不动,更不用说弹出对话框了。不知道这个情况大家有没有遇到过呢
Web前端 jQuery点击弹出上拉菜单

jQuery点击弹出下拉菜单<title>导航——点击弹出内容</title> <style type="text/css"> .navgation{margin:0;padding:0;list-style-type:none
Android android弹出菜单银屏移动

android弹出菜单屏幕移动有这样一个效果:从屏幕左边弹出一个宽度为w对话框,然后屏幕里面的activity就往左边移动w距离。请问用什么方法可以实现这个方法呢解决方案
ASP.NET 点击按钮弹出网页的有关问题

点击按钮弹出网页的问题请问一下各位,我在网页上放置一个按钮,点击时弹出另一个页面,在我的机子上运行时可以弹出,当把网站打包安装到另一台电脑时,点击按钮,就弹不出网页,这是是么问题,谢谢! 我按钮中的代码是这样的 protected void
VB VB怎么点击网页弹出提示窗口的按钮

VB如何点击网页弹出提示窗口的按钮某网页,点击按钮后会出现一个弹出窗口,在网上找,在CSDN上问,会找出其弹出窗口的文字内容了,但是其上面还有是、否或确定取消一两个按钮,我现在不会点这个按钮,大家支下招哈!解决方案 帮楼主顶一下... 解决方案 你这其实是一个dhtml问题吧,坛子中常有类似的问题的,搜索一下吧
VC/MFC 点击按钮后弹出另一个对话框解决方法

点击按钮后弹出另一个对话框用CDialog类做出一个选择界面:一个按钮 点击此按钮后,会弹出另外的一个对话框按钮(里面可以有输入命令的编辑框,也有可以点击确定的按钮) 请问,该如何实现上述的功能? 如何调用? 请详细些,谢谢!解决方案在拟新建的对话框类中加入Create 调用即可。 解决方案无模式
Java Web开发 点击按钮,弹出保存、打开对话框解决方案

点击按钮,弹出保存、打开对话框怎样在html页面上加按钮跟响应实现这个功能?就比如像平时网页上看到的下载,一点就出来个对话框,有打开,保存,取消的,点保存还能选择保存路径的,怎么搞???解决方案你只要把文件链接放到页面上,其他的就是浏览器的事情了。 解决方案探讨你只要把文件链接放到页面上,其他的就是浏览器的事情
ASP.NET 如何点击按钮弹出一个小窗口

怎么点击按钮弹出一个小窗口?我做的是投票系统点击投票按钮弹出一个小窗口 小窗口里面是投票用的!~解决方案先做个隐藏的DIV,点击时再显示 解决方案window.openwindow.showModalDialogDiv第三方控件 解决方案javascript 解决方案传值可以跟url传一样吧。。?UserID

⑤ 如何在进入app程序之前自动弹出一个自定义界面

直接在android虚拟机的"应用管理"中卸载指定程序即可

关于android虚拟机调试APP程序的说明:

1.建立虚拟机
首先,根据测试仿真需要配置一个虚拟机,如下图所示,打开Eclipse软件后,在主界面点击Android Virtual Device Manager,出现虚拟机管理界面,点击New按钮弹出虚拟机参数配置界面,选择适宜的虚拟机参数比如屏幕大小、分辨率、内存RAM、SD卡大小等,填入后点击OK创建完毕后关闭虚拟机管理页面。

2.建立Android工程
建立默认参数的Android工程,在进行模拟器时,请确保你建立的工程没有错误。

3.运行android 应用
点击工程 run as android application后,系统就会启动虚拟机,在刚开始时虚拟机界面如下,一段时间后,会运行相关的程序。

注意事项:
在模拟器测试前,必须先确保已经正确的建立工程;
虚拟机建立时会进行一系列内部操作,需要花较长时间,建议,在建立一个虚拟机后不要关闭虚拟机界面,直接切换不用的工程,就可以运行不同的APP!

⑥ android studio弹出设置页面

android studio弹出设置页面?Android向上弹出设置窗口
工具原料Android
方法/步骤分步阅读
1
/6
1.PopupWindow是Android上自定义弹出窗口
PopupWindow的构造函数为
2
/6
2.主界面的layout为:
3
/6
3.PopupWindow的layout为:
4
/6
4.Activity的代码为:
5
/6
5.这三行代码
6
/6
6.测试的结果为
内容仅供参考并受版权保护

⑦ android如何写一个自定义的dialog可以在Title的位置弹出来

<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/title_height"
android:background="@drawable/bg_top_title"
>

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Title"
android:textSize="20sp"
android:layout_centerInParent="true"/>


<ImageView
android:layout_width="@dimen/header_btn_width"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:layout_alignParentTop="true"
android:paddingLeft="4dp"
android:id="@+id/right_button"
android:src="@drawable/arrow_dropdown_pressed"
android:layout_alignParentRight="true"
/>
</RelativeLayout>
弹出的dialog的Layout为
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/dropdownBckgrnd"
android:background="@drawable/bg_pop_up_dimmer"
>

<ImageView
android:layout_width="@dimen/header_btn_width"
android:layout_height="wrap_content"
android:layout_marginTop="14dp"
android:layout_alignParentTop="true"
android:paddingLeft="4dp"
android:id="@+id/right_button"
android:src="@drawable/arrow_dropdown_pressed"
android:layout_alignParentRight="true"
/>

<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:layout_marginTop="35dp"
android:orientation="vertical"
android:focusable="true"
android:focusableInTouchMode="true"
android:background="@drawable/topmenu_popup_down">

<Button
android:layout_width="fill_parent"
android:layout_height="45dp"
android:background="@drawable/main_menu_button_background"
android:layout_margin="@dimen/button_margin_top"
android:text="aaa"
/>

<Button
android:layout_width="fill_parent"
android:layout_height="45dp"
android:background="@drawable/main_menu_button_background"
android:layout_margin="@dimen/button_margin_top"
android:text="bbb"
/>

<Button
android:layout_width="fill_parent"
android:layout_height="45dp"
android:background="@drawable/main_menu_button_background"
android:layout_margin="@dimen/button_margin_top"
android:text="ccc"
/>
</LinearLayout>
</RelativeLayout>

⑧ android 如何实现点击imageview弹出自定义的窗口activity

先给你的ImageView设置OnClickListener或者OnTouchListener,然后在onClick或者onTouch方法里抛出Intent来启动你需要的activity

⑨ android开发百度地图怎么实现自定义弹出窗口

基本原理就是用ItemizedOverlay来添加附加物,在OnTap方法中向MapView上添加一个自定义的View(如果已存在就直接设为可见),下面具体来介绍我的实现方法:
一、自定义覆盖物类:MyPopupOverlay,这个类是最关键的一个类ItemizedOverlay,用于设置Marker,并定义Marker的点击事件,弹出窗口,至于弹出窗口的内容,则通过定义Listener,放到Activity中去构造。如果没有特殊需求,这个类不需要做什么改动。代码如下,popupLinear这个对象,就是加到地图上的自定义View:
public class MyPopupOverlay extends ItemizedOverlay<OverlayItem> {

private Context context = null;
// 这是弹出窗口, 包括内容部分还有下面那个小三角
private LinearLayout popupLinear = null;
// 这是弹出窗口的内容部分
private View popupView = null;
private MapView mapView = null;
private Projection projection = null;
// 这是弹出窗口内容部分使用的layoutId,在Activity中设置
private int layoutId = 0;
// 是否使用网络带有A-J字样的Marker
private boolean useDefaultMarker = false;
private int[] defaultMarkerIds = { R.drawable.icon_marka,
R.drawable.icon_markb, R.drawable.icon_markc,
R.drawable.icon_markd, R.drawable.icon_marke,
R.drawable.icon_markf, R.drawable.icon_markg,
R.drawable.icon_markh, R.drawable.icon_marki,
R.drawable.icon_markj, };
// 这个Listener用于在Marker被点击时让Activity填充PopupView的内容
private OnTapListener onTapListener = null;
public MyPopupOverlay(Context context, Drawable marker, MapView mMapView) {
super(marker, mMapView);
this.context = context;
this.popupLinear = new LinearLayout(context);
this.mapView = mMapView;
popupLinear.setOrientation(LinearLayout.VERTICAL);
popupLinear.setVisibility(View.GONE);
projection = mapView.getProjection();
}
@Override
public boolean onTap(GeoPoint pt, MapView mMapView) {
// 点击窗口以外的区域时,当前窗口关闭
if (popupLinear != null && popupLinear.getVisibility() == View.VISIBLE) {
LayoutParams lp = (LayoutParams) popupLinear.getLayoutParams();
Point tapP = new Point();
projection.toPixels(pt, tapP);
Point popP = new Point();
projection.toPixels(lp.point, popP);
int xMin = popP.x - lp.width / 2 + lp.x;
int yMin = popP.y - lp.height + lp.y;
int xMax = popP.x + lp.width / 2 + lp.x;
int yMax = popP.y + lp.y;
if (tapP.x < xMin || tapP.y < yMin || tapP.x > xMax
|| tapP.y > yMax)
popupLinear.setVisibility(View.GONE);
}
return false;
}
@Override
protected boolean onTap(int i) {
// 点击Marker时,该Marker滑动到地图中央偏下的位置,并显示Popup窗口
OverlayItem item = getItem(i);
if (popupView == null) {
// 如果popupView还没有创建,则构造popupLinear
if (!createPopupView()){
return true;
}
}
if (onTapListener == null)
return true;
popupLinear.setVisibility(View.VISIBLE);
onTapListener.onTap(i, popupView);
popupLinear.measure(0, 0);
int viewWidth = popupLinear.getMeasuredWidth();
int viewHeight = popupLinear.getMeasuredHeight();
LayoutParams layoutParams = new LayoutParams(viewWidth, viewHeight,
item.getPoint(), 0, -60, LayoutParams.BOTTOM_CENTER);
layoutParams.mode = LayoutParams.MODE_MAP;
popupLinear.setLayoutParams(layoutParams);
Point p = new Point();
projection.toPixels(item.getPoint(), p);
p.y = p.y - viewHeight / 2;
GeoPoint point = projection.fromPixels(p.x, p.y);
mapView.getController().animateTo(point);
return true;
}
private boolean createPopupView() {
// TODO Auto-generated method stub
if (layoutId == 0)
return false;
popupView = LayoutInflater.from(context).inflate(layoutId, null);
popupView.setBackgroundResource(R.drawable.popupborder);
ImageView dialogStyle = new ImageView(context);
dialogStyle.setImageDrawable(context.getResources().getDrawable(
R.drawable.iw_tail));
popupLinear.addView(popupView);
android.widget.LinearLayout.LayoutParams lp = new android.widget.LinearLayout.LayoutParams(
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
lp.topMargin = -2;
lp.leftMargin = 60;
popupLinear.addView(dialogStyle, lp);
mapView.addView(popupLinear);
return true;
}
@Override
public void addItem(List<OverlayItem> items) {
// TODO Auto-generated method stub
int startIndex = getAllItem().size();
for (OverlayItem item : items){
if (startIndex >= defaultMarkerIds.length)
startIndex = defaultMarkerIds.length - 1;
if (useDefaultMarker && item.getMarker() == null){
item.setMarker(context.getResources().getDrawable(
defaultMarkerIds[startIndex++]));
}
}
super.addItem(items);
}
@Override
public void addItem(OverlayItem item) {
// TODO Auto-generated method stub
// 重载这两个addItem方法,主要用于设置自己默认的Marker
int index = getAllItem().size();
if (index >= defaultMarkerIds.length)
index = defaultMarkerIds.length - 1;
if (useDefaultMarker && item.getMarker() == null){
item.setMarker(context.getResources().getDrawable(
defaultMarkerIds[getAllItem().size()]));
}
super.addItem(item);
}
public void setLayoutId(int layoutId) {
this.layoutId = layoutId;
}
public void setUseDefaultMarker(boolean useDefaultMarker) {
this.useDefaultMarker = useDefaultMarker;
}
public void setOnTapListener(OnTapListener onTapListener) {
this.onTapListener = onTapListener;
}
public interface OnTapListener {
public void onTap(int index, View popupView);
}
}

⑩ 安卓开发 自定义界面的弹窗

viewDialog= (Button)findViewById(R.id.viewdialog);
viewDialog.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
showDialog();
}
});
public void showDialog(){
Dialog dialog = new Dialog(Main.this, R.style.DialogStyle);
dialog .requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog .getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
dialog .setContentView(R.layout.dialog);
dialog .show();
// WindowManager.LayoutParams params = dialog .getWindow().getAttributes();
// params.width = 800;
// params.height = 550 ;
// dialog .getWindow().setAttributes(params);
}

dialog.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listview"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</LinearLayout>
注释的部分是设置dialog的大小
listview跟在activity中添加一样的,定义listview组件时加dialog.findbyid(...),arrayadapter网上资料很多,随便看看

阅读全文

与android自定义弹出层相关的资料

热点内容
vb编程10个随机函数 浏览:11
程序员个人简介100 浏览:770
土木工程师算法工程师 浏览:90
javaexcel导入oracle 浏览:877
如何设置异地服务器 浏览:882
为什么安卓手机蓝牙耳机不会弹窗 浏览:546
linuxf77编译器安装教程 浏览:949
android本地录音权限 浏览:446
加密u盘内容怎么拷贝 浏览:283
安卓手机为什么看不到iso文件 浏览:582
用图片做文件夹图标 浏览:693
java正则表达式语法 浏览:865
美图秀在线压缩图片 浏览:184
苹果自带控制app是什么 浏览:907
孩子学编程怎么样 浏览:589
网络编程经典书籍 浏览:612
曲靖创建网站java程序员 浏览:690
256位加密中是什么意思 浏览:97
php多维数组去重 浏览:308
做程序员这一行储备人才怎么看 浏览:461