Объект ImageView всегда нулевой - PullRequest
0 голосов
/ 03 сентября 2010

У меня есть очень простой макет активности Android, такой как:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
    <ImageView id="@+id/blaimg"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>
</LinearLayout>

Теперь, когда я делаю следующее из onOptionsItemSelected:

ImageView imgView = (ImageView)findViewById(R.id.blaimg);

, содержимое imgViewвсегда ноль!Что я делаю не так?

Спасибо!

1 Ответ

0 голосов
/ 03 сентября 2010

измените объявление ImageView на ::

<ImageView android:id="@+id/blaimg"     
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"/>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...