0

I have to load an image for image button on create.I wrote the below code.The image is not loaded when it comes in the UI.What am i doing wrong.This is my master activity and i am inheriting this in another activities.

super.onCreate(savedInstanceState);  
setContentView(R.layout.activity_master_page);  
TheContext = this;  
ImageButton ThePosLogoL=(ImageButton)findViewById(R.id.btnposlogo);  
ThePosLogoL.setBackgroundResource(R.drawable.smalllogo);   

Here is my button Layout

<ImageButton
android:id="@+id/btnposlogo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@null"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true" />   
4

1 回答 1

2
ThePosLogoL.setImageResource(R.drawable.smalllogo); 
于 2013-03-22T06:46:09.367 回答