【发布时间】:2014-05-04 00:03:18
【问题描述】:
我的意图是在滚动视图上创建一个小部件列表,在它们后面的屏幕中心有一个 ImageView。这就是我所拥有的,当一切都说完之后会有更多的按钮:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:contentDescription="@string/description"
android:src="@drawable/myImage"
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:scaleType="centerInside" />
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="@android:color/transparent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
android:background="@android:color/transparent">
<Button xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/newButton"
style="@style/homeScreenButton"
android:text="@string/new_profile" />
<Button xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/loadButton"
style="@style/homeScreenButton"
android:text="@string/load_profile" />
<Button xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/calculatorButton"
style="@style/homeScreenButton"
android:text="@string/calculator" />
</LinearLayout>
</ScrollView>
</RelativeLayout>
在 Eclipse 的 xml 图形布局解释器上,屏幕按预期显示。我尝试过的 2 个不同的模拟器 Android 2.2 和 Android 4.0.3 也是如此。但是当我发送到我的实际设备时,Droid 4 w/Android 4.1.2 图像根本不显示。我什至尝试让 ScrollView 透明(android:alpha="0"),认为它以某种方式覆盖了图像,但没有。任何建议将不胜感激。
【问题讨论】: