I'm developing an android app in which I've created my own timers view , when I start showing the view on the screen (Even when I change the screen orientation) nothing is in position :

我正在开发一个Android应用程序,我在其中创建了自己的定时器视图,当我开始在屏幕上显示视图时(即使我更改了屏幕方向)也没有任何位置:

enter image description here

But as soon as I touch the screen every view take it's place...

但是当我触摸屏幕时,每个视图都会占据它的位置......

enter image description here

See the attached pictures to understand more the problem. Can anyone help me please ?

请参阅附图以了解更多问题。有人可以帮我吗?

1 个解决方案

#1


1

The problem is about width and height of the view. As I understood, the view uses some value that is equal to zero while launching to draw the circle. But it really needed to use the other value (that calculates later).

问题是关于视图的宽度和高度。据我所知,视图在启动绘制圆时使用了一些等于零的值。但它确实需要使用其他值(稍后计算)。

This is reather popular problem: onCreate .. onPause methods do not know its own sizes and window sizes.

这是reather流行的问题:onCreate .. onPause方法不知道自己的大小和窗口大小。

Solution: is to create your own observer that execute some code after the activity will know its sizes.

解决方案:创建自己的观察者,在活动知道其大小后执行一些代码。

Here you know read wonder samples to fix similar issues. https://stackoverflow.com/a/24035591/1979882

在这里你知道阅读奇迹样本来解决类似的问题。 https://stackoverflow.com/a/24035591/1979882

更多相关文章

  1. (Java)出现/消失JPanel中的JLabel仅在调整大小时消失
  2. 做一个没有视图的零食吧?

随机推荐

  1. 详解 PHP 异步后台处理
  2. 5种PHP定义数组的方法
  3. 教你用php读取elf结构
  4. PHPer都应当掌握的注释标记!
  5. 总结一些php命令行下的常用命令
  6. 关于php curl异步并发请求http
  7. 处理 PHP 开发版本问题
  8. 最快速度安装php(centos8)!
  9. 带你详解PHP生成器的使用
  10. 分享一个匹配8-16位数字和字母密码的正则