java - Programmatically setting two TextView side-by-side in LinearLayout -


So, I'm going through strings and boolean again via hashmap I'm keeping a TextView on LinearLayout. It's all good, whatever I have to do, is the textView of every string textview of the Boolean value Right . any idea? This is what I am looking for ...

Enter image details here < / P> Linear Liaison PlanLayout = (Vertical Layout) Find VVBID (R.D. Planlayout); (Map. Entry & lt; string, boolean & gt; entry: plans.entrySet ()) {string key = entry.getKey (); Boolean value = entry.getValue (); TextView keyTV = new text view (this); KeyTV.setText (key + "|"); // here is where I want to set the textview of the boolean to the right of the key TV plan. Layout. Adwew (key tv); }

Updated using the spell-aware

  Linear layout plan layout = (linear timepiece) Find VVBID ( R.D. Planlayout); (Map. Entry & lt; string, boolean & gt; entry: plans.entrySet ()) {string key = entry.getKey (); Boolean value = entry.getValue (); TextView keyTV = new text view (this); SpannableString SS = New SpannableString (value.toString ()); Clickable Spray Clickable Space = New Clickable Spans () {@ Override Public Zero (Click Text View) {Toast. Make Text (getApplicationContext (), "Clicked", Toast.LnnGHIHART). Show (); Println ("hello"); }}; Ssssps (clickable span, 0, 4, span.nn_excLUSIVE_EXCLUSIVE); KeyTV.setText (key + "|" + ss); KeyTV.setMovementMethod (LinkMovementMethod.getInstance ()); KeyTV.setTextSize (TypedValue.COMPLEX_UNIT_SP, 20); PlanLayout.addView (keyTV); }}  

A LinearLayout can only be placed in one Direction: vertical, in this case From:

A layout that organizes your children in a column or a line in the direction of the line setOrientation () .

By calling you add a second horizontal LinearLayout (one item for each) and textViews as your children, in this case it only has one TextView It will be easy to add value to an object.

If you need only a portion of the text to be clickable, you can use it to get ( setMovementMethod () also use it Remember to).


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -