Hello, I want to display a relativelayout inside a tablelayout
programatically but the relativelayout does not display. This is my
code:

        TableLayout table = new TableLayout(this);
        android.widget.TableLayout.LayoutParams tParams =new
TableLayout.LayoutParams(android.widget.TableLayout.LayoutParams.FILL_PARENT,android.widget.TableLayout.LayoutParams.FILL_PARENT);


        table.setLayoutParams(new
TableLayout.LayoutParams(android.widget.TableLayout.LayoutParams.FILL_PARENT,android.widget.TableLayout.LayoutParams.FILL_PARENT));

           RelativeLayout       rLayout = new
RelativeLayout(getApplicationContext());
                //LayoutParams rlParams = new
LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT);
               RelativeLayout.LayoutParams rlParams = new
RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT);
               rLayout.setLayoutParams(rlParams);
               Bitmap bm = getBitmapFromURL("http://www.opencmshispano.com/
opencms752/export/sites/opencmshispano/galerias/imagenes/
logo_opencmshispano.jpg");
                   ImageView imageView = new ImageView(getApplicationContext());
               Bitmap bitmapReflected = createReflectedImage(bm);
               imageView.setImageBitmap(bitmapReflected);
               imageView.setLayoutParams(new
LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
               RelativeLayout.LayoutParams rlParams2 = new
RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
                   imageView.setLayoutParams(rlParams2);
                   RelativeLayout.LayoutParams tParamsRel =  new
RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
                   tParamsRel.addRule(RelativeLayout.CENTER_HORIZONTAL,
RelativeLayout.TRUE);
                   tParamsRel.setMargins(0, bm.getHeight()+4, 0, bm.getWidth());
                   TextView text=new TextView(getApplicationContext());
                   text.setText("HOLA ME LLAMO PEPE");
                   text.setTextSize(10);
                   text.setTextColor(Color.WHITE);
                   
text.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD_ITALIC),
Typeface.BOLD_ITALIC);
                   text.setLayoutParams(tParamsRel);
                   rLayout.addView(imageView);
                   rLayout.addView(text);

            TableRow tr = new TableRow(this);
            tr.setLayoutParams(new
TableRow.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));

            ImageView view = new ImageView(this);
            Bitmap icon=
BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.star_on);
            view.setImageBitmap(createReflectedImage(icon));
            tr.addView(view);
            tr.addView(rLayout);
            ImageView view2 = new ImageView(this);
            Bitmap icon2=
BitmapFactory.decodeResource(getApplicationContext().getResources(),R.drawable.star_on);
            view2.setImageBitmap(createReflectedImage(icon2));
            tr.setGravity(Gravity.CENTER_VERTICAL);
            tr.addView(view2);


            table.addView(tr);
            setContentView(table);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to