 |
|
|  |
µ¿ÀûÀ¸·Î LinearLayout ȸ鿡 À̹ÌÁö Ãß°¡Çϱâ2 |
|
|
 |
8³â Àü |
// MainAct.java
import android.app.Activity;
import android.os.Bundle;
public class MainAct extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(new ViewEx(this));
}
}
// ViewEx .java
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
public class ViewEx extends LinearLayout {
private LinearLayout mllBlogerName;
private ImageView mivBlogPhoto;
private LayoutInflater m_AttachLayoutInflater;
public ViewEx(Context context) {
super(context);
// TODO Auto-generated constructor stub
init();
}
public void init() {
m_AttachLayoutInflater = (LayoutInflater) getContext()
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View attachView = m_AttachLayoutInflater.inflate(R.layout.main, null);
// ±×¸² ÀоîµéÀ̱â
Resources r = this.getResources();
Bitmap image = BitmapFactory.decodeResource(r,
R.drawable.icon_contribute);
// »õ·Î¿î ImageView »ý¼º
mivBlogPhoto = new ImageViewEx(getContext());
// xml FileÀÇ "android:scaleType"°ú µ¿ÀÏÇÑ È¿°ú
mivBlogPhoto.setScaleType(ImageView.ScaleType.FIT_CENTER);
// ½ÇÁ¦·Î ImageÆÄÀÏÀº DownloadÇÏ¿© BitMapÇü½ÄÀ¸·Î °¡Á®¿Í ImageView¿¡ ÇÒ´ç
mivBlogPhoto.setImageBitmap(image);
this.addView(attachView);
this.addView(mivBlogPhoto, 1, new ViewGroup.LayoutParams(48,
48));
}
}
// main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:id="@+id/blog_name_ll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="¸Þ½ÃÁö ÀÔ·Â : "
android:gravity="bottom"
/>
<EditText android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/blog_title"
android:editable="true"
android:gravity="bottom"
/>
</LinearLayout>
|
|
̵̧ : 284 |
̵̧
¸ñ·Ï
|
|
|  |
|