I would need to create a scrollview directly from Java code so I wrote this code (which I use in an AlertDialog).
TextView myTextView = new TextView(context);
myTextView.setText("Very long text" + longTextVariable);
ScrollView scroll = new ScrollView(context);
scroll.setBackgroundColor(android.R.color.transparent);
scroll.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
builder.setView(myTextView);
builder.setView(scroll);
But it doesn't work because I do not see anything. To make you understand what I'm doing I tell you simply that I need to display text that very long without scroll view are "cut".