以下のように、LinearLayoutの高さをmatch_parentに設定しています。
<LinearLayout
android:id="@+id/list_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
このLinearLayoutの高さを取得したいと思います。
私は以下のコードを使用しました:
LinearLayout ll_list = (LinearLayout)findViewById(R.id.list_layout);
int h = ll_list.getHeight();
ただし、nullを返します。
どのようにできるのか?