图像未在模拟器中显示

时间:2014-10-19 08:58:44

标签: java android xml

我正在实施一个类似于任何其他应用的简单网页,一个'标题图片'和以下内容。

我已将wedhead.png文件手动放入我要显示的所有可绘制文件夹中。

This is the thing i wish to implement

我希望实现的布局在图形编辑器上正确显示,但不在模拟器上显示。模拟器空白。仿真器是基于ARM CPU的。

模拟器屏幕 -

enter image description here

这是我的代码

XML文件:

<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.wwmk1.MainActivity" >

  <ImageView
      android:id="@+id/img1"
      android:layout_width="match_parent"
      android:layout_height="160dp"
      android:layout_marginBottom="19dp"
      android:contentDescription="header"
      android:fadingEdge="vertical"
      android:src="@drawable/wedhead"
      android:visibility="visible" />

</RelativeLayout>

主要活动java文件

    package com.example.wwmk1;

import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ImageView;


public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

      ImageView iv = (ImageView)findViewById(R.id.img1);

    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}

我哪个地方出错了? 请帮忙。感谢

0 个答案:

没有答案
相关问题