1
我的布局与居中图片视图。屏幕高度取决于主题
<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/WHITE">
<ImageView
android:id="@+id/powered_by"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/powered_by" />
<ImageView
android:id="@+id/splash_logo"
android:src="@drawable/logo"
app:layout_widthPercent="70%"
app:layout_heightPercent="70%"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:visibility="invisible" />
</android.support.percent.PercentRelativeLayout>
这里是主题设置为我的活动
<style name="SplashTheme" parent="android:Theme.Holo.Light">
<item name="android:windowBackground">@drawable/splash</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
当我改变父主题android:Theme.DeviceDefault.Light
,ImageView的出现有点偏高,而不是在屏幕的中心。似乎我的设备的父视图现在不是从屏幕底部开始,而是从底部工具栏开始(我使用带屏幕按钮的Nexus 5X)。
我想为现代对话框外观使用设备默认主题,但我也需要在所有设备上精确地显示此图像视图。
怎么办?
不幸的是,它对我不起作用。我使用了相同的样式,图像视图不以此为中心。 –
需要发布布局代码,然后查看问题是否存在 – ganlaw