如何在先前设置的textswitcher中获得文本。就像textview.getText()一样。我尝试过以下代码,但没有成功。
TextSwitcher textSwitcher = (TextSwitcher)findViewById(...);
TextView currentlyShownTextView = (TextView) textSwitcher.getCurrentView();
String currentlyShownText = textSwitcher.getText().toString();发布于 2016-11-21 06:40:55
参考this答案
TextSwitcher twTime = (TextSwitcher) findViewById(R.id.textSwotcher);
twTime.setCurrentText("your text");
TextView tv = (TextView) twTime.getCurrentView();
if (tv.getText().toString().length()>0) {
//your action here
}https://stackoverflow.com/questions/40714049
复制相似问题