public class LOLActivity extends AppCompatActivity {
@BindView(R.id.f)
private FlexboxLayout flexboxLayout;
private Context context;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lol);
context = this;
Injector.init(this);
flexboxLayout.post(new Runnable() {
@Override
public void run() {
Log.i("TAG", "width: "+ DrawUtils.px2dp(context,flexboxLayout.getWidth()));
}
});
}
}
在onCreate()方法中获取view的width和height
最新推荐文章于 2020-03-16 13:09:12 发布