package com.ydl.ydlcommon.utils

import android.view.View
import android.view.ViewGroup

/**
 * view 工具类
 * Created by harvie on 2017/10/27 0027.
 */
object ViewUtils{

    fun setMargins (v : View, l:Int, t : Int, r : Int, b : Int) {
        if (v.getLayoutParams() is ViewGroup.MarginLayoutParams) {
            var p: ViewGroup.MarginLayoutParams = v.getLayoutParams() as ViewGroup.MarginLayoutParams
            p.setMargins(l, t, r, b)
            v.requestLayout()
        }
    }
}