package com.example.picshow;

import android.os.Bundle;
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.Gravity;
import android.view.Menu;
import android.widget.ImageView;
import android.widget.LinearLayout;

public class MainActivity extends Activity {

ImageView[] iv = new ImageView[2];

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.HORIZONTAL);
ll.setGravity(Gravity.CENTER);
setContentView(ll);

Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.images);

for(int i=0;i<iv.length;i++){
iv[i] = new ImageView(this);
iv[i].setImageBitmap(bmp);
ll.addView(iv[i]);
}
}


@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;
}

}

arrow
arrow
    創作者介紹
    創作者 痞客興 的頭像
    痞客興

    痞客興的部落格

    痞客興 發表在 痞客邦 留言(0) 人氣()