Answer the question
In order to leave comments, you need to log in
How to make a textview randomly appear on the screen?
There is a file in which the text was written line by line (n-number of lines ..). Each row is added to the ArrayList.
Task: take a string from an array and put it in a textview. The TextView should appear randomly within the screen. What are the methods for managing textview on the screen. And how to create them (textview widgets) a lot like components in a listView.
The question is quite interesting, maybe someone has similar projects in mind
Answer the question
In order to leave comments, you need to log in
The task is not interesting, rather banal to the limit :) You need some kind of FrameLayout, in which, using the #addView method, you insert the TextView created in the code and change the absolute XY coordinates.
FrameLayout frameLayout = findViewById(R.id.frame);
TextView textView = new TextView(getContext());
frameLayout.addView(textView);
// С помощью класса Random сгенерируй случайные координаты в пределах
// доступного пространства на экране
textView.setX(100);
textView.setY(100);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question