I am creating a runnable typewriter effect using a textview inside a scrollview.
this is what I did...
final ScrollView sv = new ScrollView(this);
sv.setLayoutParams(new LinearLayout.LayoutParams((int)display.getWidth()/2, (int)((display.getHeight()/4))*3));
sv.setPadding(0, px2DP(10), px2DP(10), px2DP(10));
final CharSequence text = getResources().getText(R.string.longstring);
final TextView content = new TextView(this);
content.setBackgroundColor(getResources().getColor(R.color.Black));
content.setTextColor(getResources().getColor(R.color.White));
content.setTextSize(TypedValue.COMPLEX_UNIT_SP,20);
content.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT));
sv.addView(content);
content.postDelayed(new Runnable(){
@Override
public void run() {
content.append(text.subSequence(0, index++));
sv.fullScroll(View.FOCUS_DOWN);
}
},70);
I am only getting a black box and no text.
What am I doing wrong? Please help.
PS. I already found the solution!