'FIT_XY'에 해당되는 글 1건

  1. 2011.05.27 [안드로이드] xml 없이 직접 코딩하기
  
순서 없이 그냥 막 넣어 놨씁니다.
필요한 것들만 쓰면 됨.
        LinearLayout layout = new LinearLayout(getApplicationContext());
        layout.setOrientation(LinearLayout.VERTICAL);
        layout.setBackgroundColor(Color.WHITE);

        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
        LinearLayout.LayoutParams.FILL_PARENT,
        LinearLayout.LayoutParams.FILL_PARENT);

        layoutParams.setMargins(0,0,0,0);
        layoutParams.weight = 1.0f;
 
        mGallery.setIsGalleryCircular(false);
        
        FrameLayout layFrame = new FrameLayout(getApplicationContext());
        
   
        layFrame.setBackgroundResource(R.drawable.top_logo);        
   
        ImageButton homeButton = new ImageButton(getApplicationContext());
        homeButton.setBackgroundResource(R.drawable.btn_category_mainnews_off);
                 
        FrameLayout.LayoutParams layoutParams3 = new FrameLayout.LayoutParams(
                93,45);
        
        layoutParams3.gravity = Gravity.LEFT;
        layoutParams3.topMargin = 13;
        layoutParams3.leftMargin = 10;
    
        LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
        LinearLayout.LayoutParams.FILL_PARENT,
        LinearLayout.LayoutParams.WRAP_CONTENT);
           
        layoutParams.setMargins(30, 20, 20, 20);

        contentView = new TextView(getApplicationContext());
           
        contentView.setTextColor(Color.rgb(51,51,51));
           
        contentView.setTextSize(defaltSize);

        imageView = new ImageView(getApplicationContext());
        ImageView iv = new ImageView(this);
        iv.setImageResource(R.drawable.test01);
        iv.setAdjustViewBounds(true);
        iv.setLayoutParams(new Gallery.LayoutParams(
                LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        iv.setScaleType(ImageView.ScaleType.FIT_XY); // 레이아웃 크기에 이미지를 맞춘다
       
        mLinearLayout.addView(iv);
        setContentView(mLinearLayout);
Posted by 예배하는 프로그래머