关于自定义ActionBar的问题,求大神解答 导航ActionBar标题 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 自定义ActionBar视图,getSupportActionBar().setCustomView(LayoutInflater.from(this).inflate(R.layout.title, null)); 其中title为自定义的布局文件。 然后再设置getSupportActionBar().setDisplayShowCustomEnabled(true); getSupportActionBar().setDisplayShowHomeEnabled(false); getSupportActionBar().setDisplayShowTitleEnabled(false);这几个属性 请问这个布局文件是在drawable文件夹下定义吗还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响 请问这个布局文件是在drawable文件夹下定义吗还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响第一个问题,我写的是R.layout.title,当然是定义在layout下;第二个问题,getSupportActionBar()是因为我使用一个开源库,用来兼容低版本的手机,你使用getActionBar()是没有问题的,就是3.0以下版本是不兼容的。 请问这个布局文件是在drawable文件夹下定义吗还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响第一个问题,我写的是R.layout.title,当然是定义在layout下;第二个问题,getSupportActionBar()是因为我使用一个开源库,用来兼容低版本的手机,你使用getActionBar()是没有问题的,就是3.0以下版本是不兼容的。谢谢我的布局文件这样写的,但不知道为什么还是不能居中显示<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/about_actionbar_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="关于" android:textSize="18sp" /></RelativeLayout> 请问这个布局文件是在drawable文件夹下定义吗还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响第一个问题,我写的是R.layout.title,当然是定义在layout下;第二个问题,getSupportActionBar()是因为我使用一个开源库,用来兼容低版本的手机,你使用getActionBar()是没有问题的,就是3.0以下版本是不兼容的。Activity中的代码 super.onCreate(savedInstanceState); ActionBar actionBar = this.getActionBar(); actionBar.setHomeButtonEnabled(true); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayUseLogoEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setIcon(R.drawable.icon_back_btn_normal); setContentView(R.layout.about); /** * actionBar添加自定义view */ View actionbarLayout = LayoutInflater.from(this).inflate(R.layout.about_actionbar, null); actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(actionbarLayout); 请问这个布局文件是在drawable文件夹下定义吗还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响第一个问题,我写的是R.layout.title,当然是定义在layout下;第二个问题,getSupportActionBar()是因为我使用一个开源库,用来兼容低版本的手机,你使用getActionBar()是没有问题的,就是3.0以下版本是不兼容的。谢谢我的布局文件这样写的,但不知道为什么还是不能居中显示<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/about_actionbar_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="关于" android:textSize="18sp" /></RelativeLayout>android:gravity="center"加上这句 请问这个布局文件是在drawable文件夹下定义吗还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响第一个问题,我写的是R.layout.title,当然是定义在layout下;第二个问题,getSupportActionBar()是因为我使用一个开源库,用来兼容低版本的手机,你使用getActionBar()是没有问题的,就是3.0以下版本是不兼容的。谢谢我的布局文件这样写的,但不知道为什么还是不能居中显示<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/about_actionbar_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="关于" android:textSize="18sp" /></RelativeLayout>android:gravity="center"加上这句在RelativeLayout里加了android:layout_gravity="center"在TextView里加了android:gravity="center"都没用 <?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:gravity="center_vertical" android:background="@color/maincolor"> <ImageButton android:id="@+id/arClose" android:layout_width="50dp" android:layout_height="44dp" android:src="@drawable/icon_back" android:onClick="onClick" android:background="@null" /> <TextView android:id="@+id/arTitle" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:textColor="@color/white" android:text="Title" android:gravity="center" android:textSize="16sp" /></LinearLayout> android用来做智能网关的可行性如何? listView的item动态增加多个layout android 待机 急,求大神帮忙啊,关于service更新进度条问题!!! android 远程连接电脑桌面原理,有谁知道和我说下 如何让安卓平板和台式电脑通过wifi互发数据包 andorid游戏一般用什么机型测试的? 如何程序代码中动态分布textview 我想把应用像360,QQ那样,一直挂在状态栏那里 安卓客户端json中文乱码 如何在系统拨号盘里,输入#号键 Android 中WebView加载本地css和js
getSupportActionBar().setCustomView(LayoutInflater.from(this).inflate(R.layout.title, null));
其中title为自定义的布局文件。
getSupportActionBar().setDisplayShowCustomEnabled(true);
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().setDisplayShowTitleEnabled(false);
这几个属性
还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响
还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响
第一个问题,我写的是R.layout.title,当然是定义在layout下;
第二个问题,getSupportActionBar()是因为我使用一个开源库,用来兼容低版本的手机,你使用getActionBar()是没有问题的,就是3.0以下版本是不兼容的。
还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响
第一个问题,我写的是R.layout.title,当然是定义在layout下;
第二个问题,getSupportActionBar()是因为我使用一个开源库,用来兼容低版本的手机,你使用getActionBar()是没有问题的,就是3.0以下版本是不兼容的。
谢谢
我的布局文件这样写的,但不知道为什么还是不能居中显示
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" > <TextView
android:id="@+id/about_actionbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="关于"
android:textSize="18sp" /></RelativeLayout>
还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响
第一个问题,我写的是R.layout.title,当然是定义在layout下;
第二个问题,getSupportActionBar()是因为我使用一个开源库,用来兼容低版本的手机,你使用getActionBar()是没有问题的,就是3.0以下版本是不兼容的。
Activity中的代码
super.onCreate(savedInstanceState);
ActionBar actionBar = this.getActionBar();
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayUseLogoEnabled(false);
actionBar.setDisplayHomeAsUpEnabled(false);
actionBar.setIcon(R.drawable.icon_back_btn_normal);
setContentView(R.layout.about);
/**
* actionBar添加自定义view
*/
View actionbarLayout = LayoutInflater.from(this).inflate(R.layout.about_actionbar, null);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(actionbarLayout);
还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响
第一个问题,我写的是R.layout.title,当然是定义在layout下;
第二个问题,getSupportActionBar()是因为我使用一个开源库,用来兼容低版本的手机,你使用getActionBar()是没有问题的,就是3.0以下版本是不兼容的。
谢谢
我的布局文件这样写的,但不知道为什么还是不能居中显示
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" > <TextView
android:id="@+id/about_actionbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="关于"
android:textSize="18sp" /></RelativeLayout>
android:gravity="center"加上这句
还有我的只能ActionBar actionBar = this.getActionBar(); 不能getSupportActionBar() 对功能有没有什么影响
第一个问题,我写的是R.layout.title,当然是定义在layout下;
第二个问题,getSupportActionBar()是因为我使用一个开源库,用来兼容低版本的手机,你使用getActionBar()是没有问题的,就是3.0以下版本是不兼容的。
谢谢
我的布局文件这样写的,但不知道为什么还是不能居中显示
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" > <TextView
android:id="@+id/about_actionbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="关于"
android:textSize="18sp" /></RelativeLayout>
android:gravity="center"加上这句在RelativeLayout里加了android:layout_gravity="center"
在TextView里加了android:gravity="center"都没用
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="@color/maincolor"> <ImageButton
android:id="@+id/arClose"
android:layout_width="50dp"
android:layout_height="44dp"
android:src="@drawable/icon_back"
android:onClick="onClick"
android:background="@null" /> <TextView
android:id="@+id/arTitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="@color/white"
android:text="Title"
android:gravity="center"
android:textSize="16sp"
/>
</LinearLayout>