5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

LinearLayoutの高さ設定・ScrollViewの高さ設定

Last updated at Posted at 2016-05-05

LinearLayoutの高さ設定

java
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.iDを設定);
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams)linearLayout.getLayoutParams();
marginLayoutParams.height = 高さを設定;
linearLayout.setLayoutParams(marginLayoutParams);

ScrollViewの高さ設定

java
ScrollView scrollView = (ScrollView) findViewById(R.id.iDを設定);
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams)scrollView.getLayoutParams();
marginLayoutParams.height = 高さを設定;
scrollView.setLayoutParams(marginLayoutParams);

高さ以外の設定

marginLayoutParams.height = (高さを設定);
上記の height 部分を変更すると、
WidthやMarginなども設定できます。

5
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?