【发布时间】:2014-06-24 13:47:56
【问题描述】:
我正在尝试为我的应用程序创建一个界面。在 Eclipse 的布局预览中,一切正常,但是当我在真实设备上测试应用程序时,两个 ImageView 没有显示图像。我做了 2 年的 Android 应用程序,但这是我第一次遇到这个问题。 Eclipse 布局预览的屏幕截图:
这是我平板电脑的屏幕截图,没有对代码进行任何更改:
我使用的xml代码很简单:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<RelativeLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="2"
android:background="#ffffff" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@drawable/right_background"
android:orientation="vertical"
android:padding="2dp"
android:weightSum="11" >
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginBottom="2dp"
android:layout_weight="6"
android:background="@drawable/upper_container" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="12312"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:src="@drawable/video_button" />
</RelativeLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="5"
android:background="@drawable/bottom_container" >
<ImageView
android:id="@+id/imageView02"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="8dp"
android:src="@drawable/photo_button" />
</RelativeLayout>
</LinearLayout>
有人知道问题可能是什么吗?谢谢。
【问题讨论】:
标签: android eclipse image imageview device