android 标题栏布局

fangchenxuan 2010-05-29 03:27:09
我的标题栏的背景图片无法完整填充到整个标题栏,使用了fill_parent为什么还不可以?
等待高手
<?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="fill_parent"
android:background="@drawable/title"
>
<TextView
android:id="@+id/tille"
android:typeface="sans"
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16.0sp"
android:textColor="@color/title"
android:textStyle="bold"
android:layout_marginLeft="5.0dip"
android:text=""
/>
<View
android:layout_gravity="left"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1.0"
/>
<TextView
android:textSize="12.0sp"
android:id="@+id/platform"
android:textColor="@color/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="3.0dip"
android:layout_gravity="center"
android:text="@string/platform"
/>
<ProgressBar
android:id="@+id/platform_bar"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5.0dip"
style="?android:attr/progressBarStyleSmallTitle"
/>
</LinearLayout>
...全文
816 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
FireOfStar 2012-05-13
  • 打赏
  • 举报
回复
先定义一个样式文件:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name ="CustomWindowTitleBg" >
<item name ="android:background" > #565656 </item>
</style >
<style name="titlebarstyle" parent="android:Theme">
<item name="android:windowTitleSize">38dip</item>
<item name ="android:windowTitleBackgroundStyle" > @style/CustomWindowTitleBg </item >
</style>
</resources>

然后在清单文件的Activity中引用这个样式就可以了。
<activity android:name=".???"
android:label="@string/app_name"
android:configChanges="keyboardHidden"
android:screenOrientation="landscape"
android:theme="@style/titlebarstyle"
>
ccll_4177 2010-07-24
  • 打赏
  • 举报
回复
标题栏的高度应该是可以改动的,自己写一个Style文件定义一下,你看OPhone的标题栏就很大,自己做的
  • 打赏
  • 举报
回复
scliuqiang 2010-05-31
  • 打赏
  • 举报
回复
LZ 截图拿出来看看嘛
也不知道你想要实现什么效果,现在效果是什么样
yihua0001 2010-05-31
  • 打赏
  • 举报
回复
这里面有数字的地方,都改大一点,看有没有什么变化,如果没有,说明你的类型已经决定了它的大小。
lhf059 2010-05-31
  • 打赏
  • 举报
回复
我有个问题就是,能改变标题栏的高度吗?
fangchenxuan 2010-05-31
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 scliuqiang 的回复:]
LZ 截图拿出来看看嘛
也不知道你想要实现什么效果,现在效果是什么样
[/Quote]
无法贴图,QQ联系 215830445,在线等高手解决
fangchenxuan 2010-05-29
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 vclongking 的回复:]
引用 1 楼 fangchenxuan 的回复:
有人知道吗
这个是你自定义的一个标题栏吗?
你这里用fill_parent 只是填满你的父容器 而不是说容器内部填满啊
[/Quote]
求解如何填满容器内部?
vclongking 2010-05-29
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 fangchenxuan 的回复:]
有人知道吗
[/Quote]这个是你自定义的一个标题栏吗?
你这里用fill_parent 只是填满你的父容器 而不是说容器内部填满啊
fangchenxuan 2010-05-29
  • 打赏
  • 举报
回复
有人知道吗

80,337

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧