textview - Text overlaying with a background color hides the image on Android? -


on android, trying create dynamic image viewer flip images , @ bottom of each image display information image,1 or 2 lines of text max. want give area displays text unique background color let stand up. works fine exception of 1 thing, when set color textview let “black” entire screen black covering image image! , not textview area. please bear in mind create dynamically doing below:

imageframe = new framelayout(this);  viewer = new imageview(this);  imageinfo = new textview(this); imageinfo.setheight(imageinfo.getlineheight()); imageinfo.setgravity(gravity.bottom); imageinfo.setbackgroundcolor(color.cyan); imageframe.addview(viewer); imageframe.addview(imageinfo); 

any appreciated

you might want set height , width dynamically well. guess textview width , height set fill_parent. if doesn't work try adding elements imageframe in different order.

below how need set widths dynamically each textview.

textview tv = (textview) findviewbyid(r.id.yourtextviewname) viewgroup.layoutparams vg1 = (viewgroup.layoutparams) tv.getlayoutparams(); vg1.width = 100;  tv.setlayoutparams(vg1); 

also try making linear layout root element inside frame layout. put textview , image view in linear layout.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -