android-flowlayout icon indicating copy to clipboard operation
android-flowlayout copied to clipboard

failed to set margins in between two items of flow layout its displaying continuously with no margins , padding ?

Open erum-hannan-10p opened this issue 9 years ago • 4 comments

<org.apmem.tools.layouts.FlowLayout android:id="@+id/flowlayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginLeft="13dp" android:layout_marginRight="13dp" android:layout_below="@+id/relLayoutSpinner"> </org.apmem.tools.layouts.FlowLayout>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativeLayout" android:orientation="vertical" android:layout_width="wrap_content" android:layout_marginLeft="13dp" android:layout_marginRight="13dp" android:layout_marginTop="5dp" android:layout_height="wrap_content" android:background="#0fb1fa"> <TextView android:id="@+id/txtViewFilterSelected" android:layout_width="wrap_content" android:layout_height="wrap_content" android:singleLine="true" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:padding="5dp" android:textSize="16sp" android:layout_marginTop="5dp" style="@style/LatoBoldStyle" android:textColor="#ffffff" android:text="Sample Text"/> <ImageView android:id="@+id/imgCancel" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/txtViewFilterSelected" android:layout_centerVertical="true" android:layout_marginRight="10dp" android:layout_marginLeft="10dp" android:layout_marginTop="10dp" android:padding="10dp" android:src="@drawable/cross"/> </RelativeLayout>

erum-hannan-10p avatar Jan 14 '16 09:01 erum-hannan-10p

any solution??

PalakSDarji avatar Apr 15 '16 16:04 PalakSDarji

I'm adding margins programmatically to the FlowLayout children's and it's not working.

final FlowLayout layout = new FlowLayout(this); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); params.setMargins(20, 20, 20, 0);

//Creating TextView TextView txt = new TextView(this); txt.setText("test"); layout.addView(txt, params);

Any solution?

pgomesrm avatar Nov 07 '16 10:11 pgomesrm

You need to use FlowLayout.LayoutParams Like this: FlowLayout.LayoutParams params = new FlowLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

buneme avatar Mar 17 '17 17:03 buneme

Using FlowLayout.LayourParams did the trick for me! I was using LinearLayout.LayoutParms too and it didn't work. Thanks!

antur123 avatar Feb 07 '18 13:02 antur123