java - Views are invisible after they was added into ViewGroup -
i'm adding views programatically framelayout
:
public class pixelgridview extends framelayout { ... public void addviewwithoutcoords(tableview view, int column, int row) { float x = column * mcellsidesize; float y = row * mcellsidesize; framelayout.layoutparams lp = new framelayout.layoutparams(viewgroup.layoutparams.wrap_content, viewgroup.layoutparams.wrap_content); view.setlayoutparams(lp); view.setleft(0); view.settop(0); view.setx(x); view.sety(y); view.setvisibility(visible); addview(view); } ... }
however, somehow invisible. getchildcount()
returns count of them. getvisibility()
each added view returns visible
.
i can drag'n'drop such views viewgroup
framelayout
, when this, earlier added views become visible.
view
layout file:
<relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:id="@+id/ivtable" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true"/> <edittext android:id="@+id/ivtablename" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:background="@color/style_table_grey" android:textcolor="@android:color/white"/> </relativelayout>
even if add new view without drag become visible.
the item view of framelayout
, relativelayout
can overlapping. if 2 item views in same positions of framelayout
, first loaded item covered later item.
Comments
Post a Comment