♠ Posted by Unknown in Android at 1:29 AM
source code 6
Tes2sanActivity.java
btn.setImageResource(R.drawable.icon);
Tes2sanActivity.java
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageButton;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.ImageButton;
public class Tes2sanActivity extends Activity {
/** Called when the activity is first created. */
Button btn;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageButton btn = (ImageButton)this.findViewById(R.id.imageButton1);
}
}
main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageButton android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/imageButton1" android:src="@drawable/icon"></ImageButton>
</LinearLayout>
hasilnya:
0 komentar:
Post a Comment