Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将 a 设置Rect为 final 并将其设置为.top .left等,并且仅从中读取。是否可以在初始化时设置尺寸?
Rect
.top
.left
public static final Rect myRect = new Rect();
根据评论,它是通过使用备用构造函数完成的:
public static final Rect myRect = new Rect(int left, int top, int right, int bottom);
查看文档