Android set height and width of Custom view programmatically

前端 未结 6 1674
感情败类
感情败类 2020-11-28 21:06

I have created a custom view named Graphview . Here is the structure for the GraphView class.

public class GraphView extends View {

    public          


        
6条回答
  •  悲&欢浪女
    2020-11-28 21:37

    On Kotlin you can set width and height of any view directly using their virtual properties:

    someView.layoutParams.width = 100
    someView.layoutParams.height = 200
    

提交回复
热议问题