Android set height and width of Custom view programmatically

前端 未结 6 1673
感情败类
感情败类 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:36

    You can set height and width like this:

    myGraphView.setLayoutParams(new LayoutParams(width, height));
    

提交回复
热议问题