0

I want to display the text view like below picture I am searching finally I got the solution from this site "https://github.com/ApmeM/android-flowlayout",but I do not know how to use this one.

How can I am using this one to display as my requirement?

enter image description here

Cœur
  • 37,241
  • 25
  • 195
  • 267
user3114723
  • 401
  • 1
  • 6
  • 17

3 Answers3

1

Try doing programmatically

FlowLayout
 inflater = (FlowLayout) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
FlowLayout ll = (FlowLayout) inflater.inflate(R.layout.main, null);
FlowLayout tv = (FlowLayout) inflater.inflate(R.layout.secondlayout, null);
tv.setLayoutParams(new FlowLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
ll.addView(tv);
setContentView(ll);

use it like this on layout

<org.apmem.tools.layouts.FlowLayout
                        xmlns:f="http://schemas.android.com/apk/res/com.lopply.lopply"
                        xmlns:android="http://schemas.android.com/apk/res/android"
                        android:id="@+id/content3"
                        android:layout_marginTop="15dp"
                        android:layout_width="230dp"
                        android:layout_height="190dp"
                        android:layout_below="@id/title3"
                        f:horizontalSpacing="2dp" >

                        <TextView
                            android:id="@+id/content3"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/label_tip_3"
                            android:textColor="#5e5e5e"
                            android:textSize="18dp" />
                        <TextView
                            android:id="@+id/lblFacebook"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/label_tip_3_facebook"
                            android:textColor="#c64d31"
                            android:textSize="18dp" />
                        <TextView
                            android:id="@+id/lblAnd"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/label_tip_3_and"
                            android:textColor="#5e5e5e"
                            android:textSize="18dp" />
                        <TextView
                            android:id="@+id/lblTwitter"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/label_tip_3_twitter"
                            android:textColor="#c64d31"
                            android:textSize="18dp" />
                        <TextView
                            android:id="@+id/lblDot"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/label_tip_3_dot"
                            android:textColor="#5e5e5e"
                            android:textSize="18dp" />
                    </org.apmem.tools.layouts.FlowLayout>
Cœur
  • 37,241
  • 25
  • 195
  • 267
Jitesh Upadhyay
  • 5,244
  • 2
  • 25
  • 43
0
<TableLayout  android:layout_width="wrap_content"
                        android:layout_height="wrap_content >

<TableRow android:layout_width="wrap_content"
  android:layout_height="wrap_content>  <TextView
                        android:id="@+id/content3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/label_tip_3"
                        android:textColor="#5e5e5e"
                        android:textSize="18dp" />
                    <TextView
                        android:id="@+id/lblFacebook"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/label_tip_3_facebook"
                        android:textColor="#c64d31"
                        android:textSize="18dp" />
                    <TextView
                        android:id="@+id/lblAnd"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/label_tip_3_and"
                        android:textColor="#5e5e5e"
                        android:textSize="18dp" />

 </TableRow>

<TableRow android:layout_width="wrap_content"
  android:layout_height="wrap_content>    <TextView
                        android:id="@+id/content3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/label_tip_3"
                        android:textColor="#5e5e5e"
                        android:textSize="18dp" />
                    <TextView
                        android:id="@+id/lblFacebook"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/label_tip_3_facebook"
                        android:textColor="#c64d31"
                        android:textSize="18dp" />
                    <TextView
                        android:id="@+id/lblAnd"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/label_tip_3_and"
                        android:textColor="#5e5e5e"
                        android:textSize="18dp" />

</TableRow>

<TableRow android:layout_width="wrap_content"
       android:layout_height="wrap_content>    <TextView
                        android:id="@+id/content3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/label_tip_3"
                        android:textColor="#5e5e5e"
                        android:textSize="18dp" />
                    <TextView
                        android:id="@+id/lblFacebook"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/label_tip_3_facebook"
                        android:textColor="#c64d31"
                        android:textSize="18dp" />
                    <TextView
                        android:id="@+id/lblAnd"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/label_tip_3_and"
                        android:textColor="#5e5e5e"
                        android:textSize="18dp" />

 </TableRow>


</TableLayout>
raj
  • 2,088
  • 14
  • 23
0

Add FlowLayout.java class(Take from android-flowLayout project) in ur package. An try this:

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    FlowLayout _flowLayout = new FlowLayout(this);
    setContentView(_flowLayout);
    TextView _tv1 = new TextView(this);
    _tv1.setBackgroundColor(Color.RED);
    _tv1.setText("bvfjjjjjjjjjjjjjjjv");
    TextView _tv2 = new TextView(this);
    _tv2.setBackgroundColor(Color.RED);
    _tv2.setText("bvfjjjjjjjjjjjjjjjv");
    TextView _tv3 = new TextView(this);
    _tv3.setText("bvfjjjjjjjjjjjjjjjv");
    TextView _tv4 = new TextView(this);
    _tv4.setText("bvfjjjjjjjjjjjjjjjv");
    TextView _tv5 = new TextView(this);
    _tv5.setText("bvfjjjjjjjjjjjjjjjv");
    TextView _tv6 = new TextView(this);
    _tv6.setText("bvfjjjjjjjjjjjjjjjv");
    _flowLayout.addView(_tv1);
    _flowLayout.addView(_tv2);
    _flowLayout.addView(_tv3);
    _flowLayout.addView(_tv4);
    _flowLayout.addView(_tv5);
    _flowLayout.addView(_tv6);
}

}
user543
  • 3,623
  • 2
  • 16
  • 14
  • hi thanks for replying me but i want create horizantally like showing in above picture,when i am using your post it will display vertically. – user3114723 Jan 20 '14 at 07:25
  • I tried this code, its working fine. Textviews displaying horizontally.Did u change anything? – user543 Jan 20 '14 at 07:31
  • hi,i am adding these text to arraylist,i want to delete the element what i touch on flowlayout,how can i possible,i am not using any adapters. – user3114723 Jan 21 '14 at 06:02