2012-03-25 102 views
0

当按下停止和播放按钮时,我正在将新图像加载到图像视图中。他们来回切换。但是,当我在我的代码中设置图像源显得非常错误。设置ImageView源无法正常工作

之前

enter image description here

然后我打电话

bottomBar.setImageResource(R.drawable.bottombuttonsstop); 

最终结果

enter image description here

布局XML

<LinearLayout 
    android:id="@+id/bottomBarBox" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" > 
    <ImageView 
     android:id="@+id/bottomBar" 
     android:layout_width="match_parent" 
     android:background="@drawable/bottombuttons" 
     android:layout_height="wrap_content" /> 
</LinearLayout> 

显然这是不是正确加载由于某种原因,任何想法?

回答

1

尝试拨打setBackgroundResource而不是setImageResource或在布局文件中设置android:src

相关问题