凡在本Theme.Light.NoTitleBar顶部边框是从哪里来的? [英] Where is this top border in Theme.Light.NoTitleBar coming from?
问题描述
我有以下的application.xml
I have the following application.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.currency.mobile.android">
<uses-permission android:name="android.permission.INTERNET"/>
<application android:icon="@drawable/icon" android:label="@string/app_name"
android:theme="@android:style/Theme.Light.NoTitleBar">
<activity android:name=".MainActivity" android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<activity android:name=".LoginActivity"/>
<activity android:name=".HomeActivity" />
<activity android:name=".FriendsActivity"/>
<activity android:name=".PlacesActivity"/>
<activity android:name=".ProfileActivity"/>
<activity android:name=".PurchasesActivity"/>
</application>
</manifest>
这是我的选项卡视图:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp"/>
</LinearLayout>
</TabHost>
在使用Theme.Light.NoTitleBar我得到中间这个丑陋的行:
When using Theme.Light.NoTitleBar I get this ugly line in the middle:
但是当我使用它Theme.Black没有这样一个奇怪的线。有办法解决它,这样我可以使用光主题?
But when I use Theme.Black it doesn't have such a weird line. Any way to fix it so that I can use light theme?
推荐答案
这实际上是主题的框架(或可能的叠加,我永远记得其中一个专门)的Android它适用于,即使他们嵌套在活动,标签。关键是要设定一个主题(在 RES /价值/ theme.xml
)的窗框
和 windowContentOverlay
设置为 @null
在容器的活动,像这样的属性:
That's actually the theme's frame (or possibly the overlay, i can never remember which one specifically), and Android applies it to activities even when they're nested inside tabs. The trick is to set a Theme (in res/value/theme.xml
) with the windowFrame
and windowContentOverlay
properties set to @null
on the container activity, like this one:
<style
name="Theme.Light.NoFrame"
parent="android:Theme.Light">
<item
name="android:windowFrame">@null</item>
<item
name="android:windowContentOverlay">@null</item>
</style>
我还建议通过在AOSP style.xml和theme.xml挖掘找出更多;主题和样式受到严重underdocumented但pretty容易,只需读取源理解。
I also recommend digging through style.xml and theme.xml in the AOSP to find out more; themes and styles are severely underdocumented but pretty easy to understand by just reading the source.
这篇关于凡在本Theme.Light.NoTitleBar顶部边框是从哪里来的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!