Android ActionBar控件使用
来源:互联网 发布:北沉香手串 淘宝 编辑:程序博客网 时间:2024/06/05 16:35
import android.app.ActionBar;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
public class ActionBarActivity extends Activity {
/**
* @author zm
*
*/
private ActionBar ab;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_actionbar);
ab = getActionBar();
// 只有当主题没有关闭的时候才会显示ActionBar
}
public void show(View view) {
// 显示ActionBar
ab.show();
}
public void hide(View view) {
// 隐藏ActionBar
ab.hide();
}
}
布局activity_actionbar文件
<?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="horizontal"
android:weightSum="2" >
<Button
android:id="@+id/btn_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
android:onClick="show"
android:layout_gravity="left"
android:padding="10dp"
android:text="显示ActionBar" />
<Button
android:id="@+id/btn_hide"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="hide"
android:text="隐藏ActionBar" />
</LinearLayout>
效果如下图所示
将主题改成Theme.Matreial.NoActionBar就Ok了
- Android ActionBar控件使用
- (Android 基础知识) ActionBar----顶部控件
- Android原生控件---ActionBar详解
- Android ActionBar使用介绍
- [Android] ActionBar的使用
- android ActionBar的使用
- android ActionBar的使用
- Android ActionBar 的使用
- android的ActionBar使用
- android ActionBar的使用
- Android ActionBar的使用
- Android actionbar 使用简介
- Android ActionBar的使用
- Android ActionBar 基本使用
- Android ActionBar使用
- Android ActionBar 使用总结
- Android ActionBar使用
- Android ActionBar使用笔记
- [翻译]Objective-C 2015新特性
- html5 百度 google地图定位关键字搜索附近
- 火狐中打开新的标签页出现白屏
- Why Python?
- Python Tutorial 学习笔记4 ——Module
- Android ActionBar控件使用
- 优惠券View(可展开的view)
- JavaScript Location 对象
- Linux查找文本
- nodejs https 请求 UNABLE_TO_GET_ISSUER_CERT_LOCALLY 错误处理
- tmux使用及个性化配置
- 静态存储区、堆和栈的区别http://blog.csdn.net/ccccdddxxx/article/details/7085165
- 个人保存 sublime3相关
- 欧拉计划第3题