社区
Android
帖子详情
请问一个出现在整个view上方的菜单是怎样制作的?
itakeblue
2012-09-15 12:02:39
如图,出现的view切换菜单,这个是通过什么方法制作的?
因为要兼容之前的设备,所以希望方法能在2.1及以上版本通过,谢谢。
...全文
143
9
打赏
收藏
请问一个出现在整个view上方的菜单是怎样制作的?
如图,出现的view切换菜单,这个是通过什么方法制作的? 因为要兼容之前的设备,所以希望方法能在2.1及以上版本通过,谢谢。
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用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的样式。
让popupwindow显示在
view
的
上方
并与该
view
水平居中对齐
让popupwindow显示在
view
的
上方
并与该
view
水平居中对齐
Fragment+PopupWindow完美实现了仿QQ空间底部
菜单
栏效果(源码+效果图)
利用了android3.0新引进的Fragment类和PopupWindow弹出
菜单
完美的实现了仿QQ空间底部
菜单
栏的效果,项目中包含效果图和项目结构图。
Android实现固定
View
在键盘
上方
(附带源码)
Android实现固定
View
在键盘
上方
(附带源码)
Pycharm
整个
菜单
栏都不见了(包括File\
View
那一栏)
一、问题描述 不知道怎么手贱把
整个
彩蛋栏都弄不见了┭┮﹏┭┮,就是如下图所包含的所有
菜单
栏: 二、解决方法 试了很多方法,最后用了如下方法终于找回来了 1. 在Pacharm中双击“shift”按键,弹出如下方框 2. 勾选如下选项,并搜索“
View
” 3. 关掉重启,Pycharm重新拥有
菜单
栏(奥利给(#^.^#)) ...
解决VsCode 软件
上方
菜单
栏消失问题
VsCode 软件
上方
菜单
栏消失
Android
80,472
社区成员
91,384
社区内容
发帖
与我相关
我的任务
Android
移动平台 Android
复制链接
扫一扫
分享
社区描述
移动平台 Android
android
android-studio
androidx
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章