package com.example.imagedynamicallyadding;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout layout = new LinearLayout(getApplicationContext());
LayoutParams parms = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
ImageView img = new ImageView(getApplicationContext());
img.setPadding(0, 0, 0, 0);
img.setImageResource(R.drawable.ic_launcher);
layout.addView(img);
setContentView(layout);
}
}
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.LinearLayout.LayoutParams;
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout layout = new LinearLayout(getApplicationContext());
LayoutParams parms = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
ImageView img = new ImageView(getApplicationContext());
img.setPadding(0, 0, 0, 0);
img.setImageResource(R.drawable.ic_launcher);
layout.addView(img);
setContentView(layout);
}
}
No comments:
Post a Comment