Android: How to Programmatically set the size of a Layout

前端 未结 4 552
南方客
南方客 2020-11-28 01:09

As part of an Android App I am building a button set. The buttons are part of a nested set of LinearLayouts. Using weight I have the set resizing itself automatically based

4条回答
  •  隐瞒了意图╮
    2020-11-28 02:05

    my sample code

    wv = (WebView) findViewById(R.id.mywebview);
    wv.getLayoutParams().height = LayoutParams.MATCH_PARENT; // LayoutParams: android.view.ViewGroup.LayoutParams
    // wv.getLayoutParams().height = LayoutParams.WRAP_CONTENT;
    wv.requestLayout();//It is necesary to refresh the screen
    

提交回复
热议问题