废话少说,直接上图,有图有真相。
这两个工具栏全是用布局来实现的。底部工具栏布局代码:
代码
<!--<br/ /><br/ />Code highlighting produced by Actipro CodeHighlighter (freeware)<br/ />http://www.CodeHighlighter.com/<br/ /><br/ />--><?xmlversion="1.0"encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/bottom"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView
android:id="@+id/edit"
android:text="测试"
android:gravity="center_horizontal"
android:drawableTop="@drawable/ic_dialog_alert"
android:layout_alignParentLeft="true"
android:layout_width="80dip"
android:layout_height="wrap_content"
>
</TextView>
<TextView
android:id="@+id/menu2"
android:text="测试"
android:gravity="center_horizontal"
android:drawableTop="@drawable/ic_dialog_dialer"
android:layout_toRightOf="@id/edit"
android:layout_width="80dip"
android:layout_height="wrap_content"
>
</TextView>
<TextView
android:id="@+id/effect"
android:text="测试"
android:gravity="center_horizontal"
android:drawableTop="@drawable/ic_dialog_email"
android:layout_toRightOf="@id/menu2"
android:layout_width="80dip"
android:layout_height="wrap_content"
>
</TextView>
<TextView
android:id="@+id/menu3"
android:text="测试"
android:gravity="center_horizontal"
android:drawableTop="@drawable/ic_dialog_info"
android:layout_toRightOf="@id/effect"
android:layout_width="80dip"
android:layout_height="wrap_content"
>
</TextView>
</RelativeLayout>
顶部工具栏布局代码:
代码
<!--<br/ /><br/ />Code highlighting produced by Actipro CodeHighlighter (freeware)<br/ />http://www.CodeHighlighter.com/<br/ /><br/ />--><?xmlversion="1.0"encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/top"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageView
android:id="@+id/undo"
android:src="@drawable/ic_dialog_map"
android:layout_alignParentLeft="true"
android:layout_width="80dip"
android:layout_height="wrap_content"
>
</ImageView>
<ImageView
android:id="@+id/save"
android:src="@drawable/ic_dialog_menu_generic"
android:layout_toRightOf="@id/undo"
android:layout_width="80dip"
android:layout_height="wrap_content"
>
</ImageView>
<ImageView
android:id="@+id/share"
android:src="@drawable/ic_dialog_time"
android:layout_toRightOf="@id/save"
android:layout_width="80dip"
android:layout_height="wrap_content"
>
</ImageView>
<ImageView
android:id="@+id/redo"
android:src="@drawable/ic_dialog_usb"
android:layout_toRightOf="@id/share"
android:layout_width="80dip"
android:layout_height="wrap_content"
>
</ImageView>
</RelativeLayout>
主窗口布局代码:
代码
<!--<br/ /><br/ />Code highlighting produced by Actipro CodeHighlighter (freeware)<br/ />http://www.CodeHighlighter.com/<br/ /><br/ />--><?xmlversion="1.0"encoding="utf-8"?>
<RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/layout_topmenu"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
>
<includelayout="@layout/top_menu"/>
</RelativeLayout>
<TextView
android:id="@+id/txt1"
android:text="asdfasdfas"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/layout_topmenu">
</TextView>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
>
<includelayout="@layout/bottom_menu"/>
</RelativeLayout>
</RelativeLayout>
主窗口代码:
代码
<!--<br/ /><br/ />Code highlighting produced by Actipro CodeHighlighter (freeware)<br/ />http://www.CodeHighlighter.com/<br/ /><br/ />-->packagecom.figoyu.photoqualify;
importandroid.app.Activity;
importandroid.os.Bundle;
importandroid.view.MotionEvent;
importandroid.view.View;
importandroid.view.Window;
importandroid.view.View.OnTouchListener;
importandroid.widget.ImageView;
importandroid.widget.TextView;
publicclassMainActivityextendsActivity{
TextViewtxt1;
TextViewedittv;
ImageViewimgbtn;
booleanisFirst=true;
booleanistopFirst=true;
@Override
publicvoidonCreate(BundlesavedInstanceState){
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
edittv=(TextView)findViewById(R.id.edit);
txt1=(TextView)findViewById(R.id.txt1);
imgbtn=(ImageView)findViewById(R.id.undo);
edittv.setOnTouchListener(newOnTouchListener(){
@Override
publicbooleanonTouch(Viewv,MotionEventevent){
if(isFirst){
txt1.setText("编辑");
edittv.setBackgroundDrawable(getResources().getDrawable(R.drawable.item_background));
isFirst=false;
}else{
txt1.setText("退出编辑");
edittv.setBackgroundDrawable(getResources().getDrawable(R.drawable.touming));
isFirst=true;
}
returnfalse;
}
});
imgbtn.setOnTouchListener(newOnTouchListener(){
@Override
publicbooleanonTouch(Viewv,MotionEventevent){
if(istopFirst){
txt1.setText("编辑");
istopFirst=false;
}else{
txt1.setText("退出编辑");
istopFirst=true;
}
returnfalse;
}
});
}
}
分享到:
相关推荐
Android顶部工具栏和底部工具栏的简单实现代码,需要的朋友可以参考一下
这个是底部和顶部工具栏的源代码 学习
Android仿微信底部菜单栏+顶部菜单栏,效果看博文http://blog.csdn.net/evankaka/article/details/44121457
主要介绍了Android仿微信底部菜单栏和顶部菜单栏实现效果,感兴趣的小伙伴们可以参考一下
在logcat标题栏右键先windows mode,这时多数能恢复过滤工具栏,要恢复之前的停靠样式再同样点右键去掉windows mode的勾即可 补充知识:Android studio底部Logcat模块不见了以及Locat日志中包含了很多无用的错误日志...
demo简单的编写了几个控件及功能的使用,可用作APP开发初始代码进行下一步开发,包括:实现底部导航栏、下拉上拉刷新、实现网络请求、api统一处理及数据处理、页面跳转并回调数据、实现本地缓存和toast及日志打印...
项目: 2021年红红岩网校寒假作业仓库...顶部工具栏首页文章列表第二页个人信息页面文章编写页面发布管理页面已收藏文章最好附上文章的浏览数等信息统计已发布文章最好附上文章的浏览数等信息统计草稿文章文章查看页面
ClockViewPager 为什么叫ClockViewPager?...滑动其中一个查看器(顶部查看器和底部查看器)时,滚动速度不同 其他特性 crystalrangeseekbar(by syedowaisali ) 过度滚动装饰( EverythingMe提供)
最全面的工具箱,可以节省电池,调整,调整,备份,保护和监控运行任何ROM,任何内核(从Android 2.3到Android L)的任何Android设备。 ☺轻松取代20多个应用,价值30欧元或更多☺☺ 入门:http: //...
在选择模式下,工具栏显示在底部(而不是顶部。这是非常重要的一点)。 并显示“在此移动”按钮以在这些位置移动项目。 您甚至可以在选择模式下导航到其他文件夹。 为什么它比其他UI模式更好? 让我们与Google的...
该模块是我其他项目的基础,该项目旨在提供Samsung roms中的补充工具栏服务。 这个项目是在AIDE(Android IDE)上设置的,对于Android Studio来说应该可以,但是我不能保证,因为我从没有尝试过。到目前为止的进展...
百度翻译源码java 很棒的 Flutter 包列表 精选清单 :page_facing_up: 真棒 :glowing_star: 颤振包。 这些是一些最有价值的宝石 ...应用程序的动画底部导航栏,图标动画到位,颜色可自定义。 Flutter 平台小部件 使用
—使用工具栏中的Gyazo图标捕获-页面元素捕获页面的各个元素,例如图像,文本框或页面的子部分 -免费选择与Gyazo桌面应用程序类似,自由捕获页面中想要的任何部分 -页面捕获页面的整个可见区域 -整个页面从顶部到...
在任务列表选中多个任务时,底部状态栏将显示已选中任务的数量及总大小 功能大全中增加"速度测试"功能 详情页中增加"复制下载链接、停止上传、种子文件另存为"等基本操作按钮 BT任务新建面板支持调整窗口大小 帐号...
1、图片幻灯模式底部工具条默认隐藏以减少看图干扰,鼠标滑过底部区域时出现(与正文模式一致) 2012-08-31 v3.1.0.2 1、修复 页面自定义方向键动作干扰幻灯模式方向键操作的问题 2012-08-30 v3.1.0.1 1、增加 图片...