android - Programatically LinearLayout Weight -
I'm trying to grow like a grid, but using What I have tried : I have a visual method that gives Any help would be appreciated. Thank you. I have a This is You can use it to get the width of the screen: The width of the screen can be accessed through the LinearLayout . I want to read 3 images after the images in a row and exact below.
LinearLayout layout = new LinearLayout (reference); Layout.setOrientation (LinearLayout.VERTICAL); ImageView icon = New ImageView (reference); Item item = getItem (page, index); Logs. E ("tag", item .getDrawable ()); imageLoader.displayImage (item.getDrawable (), icon, R.drawable.ic_launcher); Icon.setPadding (15, 15, 15, 15); Layout.addView (icon); Textview label = new textview (reference); Label.setTag ("text"); Label.setText (item.getName ()); Label.setTextColor (Color.BLACK); the label. Setgravity (Gravity tapes | Gravity CNTAROSISOSOA); Label.setLayoutParams (new layout paragraph (layout paramount. MATCH_PARENT, paragraph layout. WRAP_CONTENT)); Layout.setLayoutParams (New LinearLayout.LayoutParams (Layout P.WRAP_CONTENT, Layout Para. WRAP_CONTENT)); layout.setWeightSum (3F); Layout.addView (label);
view , so I'll take
back; At the end of the law; Here I have given the weight 3 button which is not working for me.
tablelayout < / Code> as many as
tableRow s, I need to define. On each of those
TableRows , I used the
LinearLayout with respect to the
VERTICAL two
view
ImageView < / code> and
TextView .
LinearLayout where you have to get the width of the screen and make sure that the new
linear timepieces < Adding / code> still fits in the existing row if not, just start a new
TableRow .
last display display = getWindowManager () .getDefaultDisplay (); Last point size = new point (); Display.getSize (size); Final Window Manager. Layout Parameters = The Window (). GetAttributes ();
params.width attribute, just copy it to its
LinearLayout compare to. To keep an incremental account of the GetWidth () method and the current
TableRow width (a
float ), help you determine whether the current item Should be placed an existing line or a new one
Comments
Post a Comment