相关疑难解决方法(0)

如何以编程方式调整自定义视图的大小?

我正在编写一个自定义视图,从RelativeLayout扩展,我想以编程方式调整它,我该怎么办?

自定义视图类是这样的:

public ActiveSlideView(Context context, AttributeSet attr){
        super(context, attr);
        LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        if(inflater != null){       
            inflater.inflate(R.layout.active_slide, this);
        }
Run Code Online (Sandbox Code Playgroud)

android resize

158
推荐指数
9
解决办法
23万
查看次数

标签 统计

android ×1

resize ×1