Ashraful Islam
- Forum posts: 1
Dec 28, 2014, 1:00:31 PM via Website
Dec 28, 2014 1:00:31 PM via Website
I have a multi-line textview.Its height is depend on other view.I want to get the invisible text from the textview.
I have tried this code to get the invisible text but its showing only empty text but the textview have invisible text
final TextView shortDescription = (TextView) v.findViewById(R.id.short_description);
shortDescription.setText(data.getDescription());
ViewTreeObserver vto = shortDescription.getViewTreeObserver();
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
String text = list.get(position).getDescription();
Layout layout = shortDescription.getLayout();
int end = layout.getLineEnd(layout.getLineCount() - 1);
String invisibletext = text.substring(end, text.length());
Log.e("TAG", "Invisible text:" + invisibletext);
}
});