So, for big texts I use ScrollingMovementMethod(). But there is one promblem, while the text is pressed to scroll the text turns gray. Can that be fixed?
.java
public class Knowledge extends Activity {
Button back, newText;
TextView TVHeading, TV;
void newText() {
Random rand = new Random();
int n = rand.nextInt(10) + 1;
String text = "knw" + n;
String resourceId = getResources().getString(
getResources().getIdentifier(text, "string", getPackageName()));
String[] knowledgeArray = resourceId.split("\n");
TVHeading.setText(knowledgeArray[0]);
TV.setText(knowledgeArray[1]);
}
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.knowledge);
back = (Button) findViewById(R.id.backKnowledge);
newText = (Button) findViewById(R.id.newText);
TVHeading = (TextView) findViewById(R.id.knowledgeTVHeading);
TV = (TextView) findViewById(R.id.knowledgeTV);
TV.setMovementMethod(new ScrollingMovementMethod());
newText();
back.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
newText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
newText();
}
});
}
}
Try using solid colors for your textView
attributes as follows:
android:textColor="#000000"
android:textColorHighlight="#000000"
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.