You have to use TableLayout.LayoutParams
with something like this:
TextView tv = new TextView(v.getContext());
tv.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f));
The last parameter is the weight.
More Related Contents:
- Android: Last line of textview cut off
- Change the Right Margin of a View Programmatically?
- Change the text color of a single ClickableSpan when pressed without affecting other ClickableSpans in the same TextView
- Set style for TextView programmatically
- How to make layout with rounded corners..?
- Set the absolute position of a view
- Android: Want to set custom fonts for whole application not runtime
- Android Paint: .measureText() vs .getTextBounds()
- how to read value from string.xml in android?
- Is there an easy way to strike through text in an app widget?
- How to size an Android view based on its parent’s dimensions
- how to change text in Android TextView
- Shadow Effect for a Text in Android?
- Programmatically set left drawable in a TextView
- How to force an entire layout View refresh?
- Android: Custom Title Bar
- Android – Add textview to layout when button is pressed
- “You need to use a Theme.AppCompat theme (or descendant) with the design library” error
- Placing a textview on top of imageview in android
- How to bring view in front of everything?
- How to use textview.getLayout()? It returns null
- How do I enable standard copy paste for a TextView in Android?
- Which HTML tags are supported by Android TextView?
- How to set a ripple effect on textview or imageview on Android?
- How to adjust text kerning in Android TextView?
- How to make the textview blinking
- How to expand a layout height with animation?
- How to create fixed footer in android layout?
- How to use Font Awesome icon in android application?
- Custom PopupMenu (layout)