Skip to content Skip to sidebar Skip to footer

Android-flow Layout In Java

I m giving 3 sentences in 3 text views in JAVA file in horizontal orientation but only 2 text view that is only 2 sentences are comin but the third sentence gets disappeared due to

Solution 1:

The reason you don't see the third TextView is that your layout has a horizontal orientation and while the first two TextViews fit the screen size the third one is getting pushed outside.

To fix this issue you can do several steps:

1. change your layout orientation to vertical in the XML or the java file, and that way the TextView will appear one after the other vertically.

2. if you want to keep more then one TextView in a row, then you should still set you main layout orientation to vertical, but for each row of TextView's create a new layout with horizontal orientation using code and added the TextView to this layout.

LinearLayout tvRow = new LinearLayout();
tvRow.addView(firstTextView);
tvRow.addView(secondTextView);

Finally add this layout to your main layout:

mailLayout.addView(tvRow);

Post a Comment for "Android-flow Layout In Java"