android 自定义标题未横向填充父级
我已经自定义了我的标题栏。 问题是虽然我已经提到宽度作为 fill_parent 它不填充父级 两边都有一些空格,
代码位于
<resources>
<style name="LargeTitleTheme">
<item name="android:windowTitleSize">40dip</item>
</style>
</resources>
xml2:
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/textview" android:textStyle="bold"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:gravity="center" android:text="fggffgjjkki"
android:textSize="30sp"
android:textColor="#FFFFFF" android:background="@drawable/top_bar" />
</RelativeLayout>
代码下面:
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.homegrid);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.customtitle);
I have customised my title bar.
The problem is though i have mentioned the width as fill_parent its not filling parent
with some blank space on either sides
the code is below
<resources>
<style name="LargeTitleTheme">
<item name="android:windowTitleSize">40dip</item>
</style>
</resources>
xml2:
<RelativeLayout android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/textview" android:textStyle="bold"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:gravity="center" android:text="fggffgjjkki"
android:textSize="30sp"
android:textColor="#FFFFFF" android:background="@drawable/top_bar" />
</RelativeLayout>
code:
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.homegrid);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.customtitle);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将 android:layout_marginLeft="0dp" android:layout_marginRight="0dp" 添加到relativelayout。
Try adding android:layout_marginLeft="0dp" android:layout_marginRight="0dp" to the RelativeLayout.