¾È³çÇϼ¼¿ä ¾Èµå·ÎÀ̵å Ãʺ¸ÀÔ´Ï´Ù.
µÎ °³ÀÇ Å¬·¡½º¿Í ÇϳªÀÇ xml·Î ÀÌ·ç¾îÁø °£´ÜÇÑ ¾îÇÃÀ» ¸¸µé°í ÀÖ½À´Ï´Ù.
±× ´ë·«ÀûÀÎ ±¸¼ºÀº ´ÙÀ½°ú °°½À´Ï´Ù.
public class Axis_Main extends Activity
protected void onCreate(Bundle savedInstanceState)
{
View mainView = getLayoutInflater().inflate(R.layout.activity_main, null); //xml ÆÄÀÏ inflate
RelativeLayout container = (RelativeLayout)mainView.findViewById(R.id.layout); //xmlÀÇ layout¿¡ custom view ºÙÀ̱â
draw = new Axis_Draw(this, USER_MODE_TF);
container.addView(draw,0);
setContentView(mainView);
}
Áß·«....
-----------------------------------------------------------------------------------------------------
public class Axis_Draw extends View
{
public Axis_Draw(Context context, boolean TF)
{
super(context);
if(TF == false)
{
data = new Data_Class(context);
GET_DATA_FROM_DATACLASS();
}
else if (TF == true)
{
is_USER_MODE = true;
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.activity_main, null);
((ImageView)v.findViewById(R.id.right_thing)).setVisibility(View.VISIBLE);
((ImageView)v.findViewById(R.id.left_thing)).setVisibility(View.INVISIBLE);
Áß·«.....
Á¦°¡ ¿øÇÏ´Â °ÍÀº, extends ViewÇÑ Axis_Draw¿¡¼ xml ¿¡ Á¤ÀÇµÈ imageviewµéÀ» º¸¿´´Ù ¾Èº¸¿´´Ù ÀÌ·¸°Ô Á¦¾îÇÏ´Â °ÍÀä,
ÀÌ»óÇÏ°Ô imageview ¼Ó¼º º¯°æÀÌ µÇÁö ¾Ê½À´Ï´Ù.
LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View v = inflater.inflate(R.layout.activity_main, null);
¸¦ Ãß°¡ÇÔÀ¸·Î¼ null pointer exceptionÀº ÇØ°áÇÏ¿´Áö¸¸,
((ImageView)v.findViewById(R.id.right_thing)).setVisibility(View.VISIBLE);
((ImageView)v.findViewById(R.id.left_thing)).setVisibility(View.INVISIBLE);
°¡ ¸ÔÁö ¾Ê½À´Ï´Ù;;
µµ´ëü ¿Ö ÀÌ·±°É±î¿ä?
µµ¿ò ÁÖ½Ã¸é °¨»çÇÏ°Ú½À´Ï´Ù. | |
|
draw = new Axis_Draw(this, USER_MODE_TF, mainView);
public Axis_Draw(Context context, boolean TF, View v)
·Î ¼öÁ¤ÇÏ¿© ÇØ°áÇÏ¿´½À´Ï´Ù.
·Î±×¿¡¼ toString°ªÀÌ ´Ù¸£´õ´Ï ÀÌ·± ¿øÀÎÀ̾ú±º¿ä.. Á¤¸» °¨»çµå¸³´Ï´Ù.
ÇÑ°¡Áö ´õ ºÎŹÀ» µå¸®ÀÚ¸é, GAN ¼±»ý´Ô°ú °°Àº Áö½ÄÀ» ¾òÀ¸·Á¸é ¾î¶»°Ô ¹«¾ùÀ» °øºÎÇØ¾ß ÇÒ±î¿ä?
Á¶¾ð ÇÑ ¹ø ´õ ºÎŹµå¸®¸é °¨»çÇÏ°Ú½À´Ï´Ù.
Á¤¸» °¨»çÇÕ´Ï´Ù!