I’m trying set a layout for textview
so I can use getEllipsisCount()
method. But below code returns null as layout value.
How can I take layout and then use getEllipsisCount(0)
method.
public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TextView mytextview =(TextView) findViewById(R.id.textView1);
mytextview.setText(myText);
Layout layout = mytextview.getLayout();
if(layout != null){
mytextview.setText("very good layout worked
");
}
}
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…