社区
Android
帖子详情
请问一个出现在整个view上方的菜单是怎样制作的?
itakeblue
2012-09-15 12:02:39
如图,出现的view切换菜单,这个是通过什么方法制作的?
因为要兼容之前的设备,所以希望方法能在2.1及以上版本通过,谢谢。
...全文
135
9
打赏
收藏
请问一个出现在整个view上方的菜单是怎样制作的?
如图,出现的view切换菜单,这个是通过什么方法制作的? 因为要兼容之前的设备,所以希望方法能在2.1及以上版本通过,谢谢。
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
9 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
AMinfo
2012-09-15
打赏
举报
回复
有2种方法实现:
1、用透明的Dialog;
2、将主体布局用FrameLayout,然后这个菜单层默认是隐藏的,需要的时候才显示出来。
andylao62
2012-09-15
打赏
举报
回复
用Dialog可以实现,我已经实现了这样的功能
[code=Java]
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/shortcutPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="9dip"
android:paddingBottom="3dip"
android:paddingLeft="3dip"
android:paddingRight="1dip"
android:majorWeight="0.65"
android:minorWeight="0.9"
android:layout_gravity="bottom"
android:gravity="center"
android:background="@drawable/br_iphone_touchkey_bg">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:layout_weight="1" >
<ImageView
android:id="@+id/touch_backkey"
android:tag="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
style="?android:attr/buttonStyle"
android:background="@drawable/br_iphone_touch_back" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:layout_weight="1" >
<ImageView
android:id="@+id/touch_homekey"
android:tag="2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
style="?android:attr/buttonStyle"
android:background="@drawable/br_iphone_touch_home" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:layout_weight="1" >
<ImageView
android:id="@+id/touch_menukey"
android:tag="3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?android:attr/buttonStyle"
android:layout_gravity="center"
android:background="@drawable/br_iphone_touch_menu" />
</LinearLayout>
</LinearLayout>code]
这个就是布局文件
itakeblue
2012-09-15
打赏
举报
回复
感谢各位的帮助!
李利伟不加V
2012-09-15
打赏
举报
回复
看楼主等级 应该是个高手 在此只做提示 android3.0里有个组件被之后版本沿用 fragment 使用简单方便操作 3.0版本一下 可自己倒jar包实现 具体jar包地址 自己官网找
ameyume
2012-09-15
打赏
举报
回复
[Quote=引用 4 楼 的回复:]
前一段时间也遇到过这样的问题,这个可以用dialog实现,关键是,要设置activity的主题为Holo,或者自己定义主题,里面要带有
<item name="panelMenuIsCompact">true</item>
<item name="panelMenuListWidth">250dip</item>
<item name="panelMenuListTheme"……
[/Quote]
Holo主题是3.0以上才有的。
楼主要兼容2.1
用Dialog可以试试其他属性,或许可以。
itakeblue
2012-09-15
打赏
举报
回复
[Quote=引用 2 楼 的回复:]
ActionBar吧
[/Quote]
这是3.0开始支持的方法吧
Utopia
2012-09-15
打赏
举报
回复
ActionBar吧
kaxionen2011
2012-09-15
打赏
举报
回复
用popupWindow或者AlertDialog
popupWindow实现
//显示PopupWindow
// LayoutInflater mLayoutInflater = (LayoutInflater) VideoActivity.this
// .getSystemService(LAYOUT_INFLATER_SERVICE);
// View share_popunwindwow = mLayoutInflater.inflate(
// R.layout.share, null);
// final PopupWindow mPopupWindow = new PopupWindow(share_popunwindwow, LayoutParams.FILL_PARENT,
// LayoutParams.WRAP_CONTENT);
//
// mPopupWindow.showAtLocation(findViewById(R.id.main), Gravity.RIGHT|Gravity.BOTTOM, 0, 0);
AlertDialog实现
LayoutInflater factory = LayoutInflater.from(context);
final View dialogView = factory.inflate(R.layout.share, null);
final AlertDialog dlg = new AlertDialog.Builder(
context)
.setTitle(context.getResources().getString(R.string.share))
.setView(dialogView).create();
dlg.show();
dlg.getWindow().setLayout(BaseApplication.winWidth, LayoutParams.WRAP_CONTENT);
布局代码都是下面这个
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@color/black">
<Button
android:id="@+id/btn_faceBook"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/share_to_facebook" />
<Button
android:id="@+id/btn_xinlang"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/share_to_xinlang" />
<Button
android:id="@+id/btn_cancle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/cancle" />
</LinearLayout>
样式跟那个差不多
李狗蛋52635
2012-09-15
打赏
举报
回复
前一段时间也遇到过这样的问题,这个可以用dialog实现,关键是,要设置activity的主题为Holo,或者自己定义主题,里面要带有
<item name="panelMenuIsCompact">true</item>
<item name="panelMenuListWidth">250dip</item>
<item name="panelMenuListTheme">@android:style/Theme.Holo.Light.CompactMenu</item>
的主题就好了,这会改变dialog的样式。
ActionMenu:精简版库,用于显示类似于iOS中UILabel的
菜单
(复制,全选,粘贴)的操作
菜单
ActionMenu ActionMenu is a lite library to show an action-menubar like the menus(copy, select all, paste) for UILabel in iOS. 一个轻巧易用的
菜单
库,仅需一行代码,即可显示类似于IOS中UILabel的文字
菜单
(复制、全选、粘贴)的
菜单
条。 Demo The arrow of ActionMenu will be always at center-horizontal|top of the anchor. ActionMenu的指示箭头总是会显示在anchor的
上方
中间位置。 Usage #####Show menus for a
view
显示
view
的
菜单
ActionMenu.build(activity,
view
).addActions(actions...
Sublime Text3 安装markdown插件
1.打开Sublime Text,使用快捷键 ctrl+` (左上角Tab键
上方
,Esc键下方)或者使用
菜单
View
> Show Console menu,此时将
出现
Sublime Text的控制台,将如下代码分别放入执行(按回车)即可。若Preferences 这个
菜单
下有
菜单
项 Package Control这个
菜单
,此步骤可忽略 import urllib.request,o...
使用vue uniapp
制作
一个打地鼠游戏
实现的效果如下,可在
上方
设置参数,可以设置地鼠
出现
的速度和总数; 可在代码中设置专属头像作为地鼠 代码如下,可直接复制: <template> <
view
class="game"> <
view
class="scoped"> <
view
class="set"> <uni-title type="h3" title="设置参数"></uni-title> <
view
class="setR
菜单
效果
**
菜单
效果 ** 这次讲的内容是怎样用css去
制作
一个
菜单
的消失和
出现
。首先先看一下完成后的样子,请看以下截图。 我们要完成的效果就是当鼠标移到
菜单
栏上也就是红色线上的部分,会
出现
对应的子
菜单
栏也就是深棕色框里的内容。接下来就开始看代码,首先先看HTML部分的内容,请看下面的截图。 上面三张截图里面画红色横线的代码就是
菜单
,画深棕色线的就是子
菜单
的内容。接下来我们看css部分的内容,其实思路就是当鼠标移到
菜单
栏的时候对应的子
菜单
就出来,然后为了好看的效果,我们可以在给子
菜单
一些颜色的搭配或者样式
Excel如何
制作
下拉列表
Excel下拉列表通常都是利用“数据有效性”来实现的,通过“数据有效性”设置,可以让Execl的某一单元格
出现
下来
菜单
的效果,那么如何实现excel下拉列表呢? Excel下拉列表、Excel下拉
菜单
的第一种方法(数据有效性): 第一步:打开Excel工作薄——>选定某一单元格——>点击
上方
的“数据(D)”
菜单
——>点击“有效性(L)”; 第二步:将弹出“数据有效性”窗口,在“设
Android
80,262
社区成员
91,301
社区内容
发帖
与我相关
我的任务
Android
移动平台 Android
复制链接
扫一扫
分享
社区描述
移动平台 Android
android
android-studio
androidx
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章