獲取高度LinearLayout
返回-1。LinearLayout高度返回-1
代碼:
LinearLayout layout = (LinearLayout)findViewById(R.id.create_trip_layout);
android.view.ViewGroup.LayoutParams param = layout.getLayoutParams();
Log.d("Layout height : ", param.height + "");
獲取高度LinearLayout
返回-1。LinearLayout高度返回-1
代碼:
LinearLayout layout = (LinearLayout)findViewById(R.id.create_trip_layout);
android.view.ViewGroup.LayoutParams param = layout.getLayoutParams();
Log.d("Layout height : ", param.height + "");
嘗試更改'android.view.ViewGroup.LayoutParams'到'android.Widget.LinearLayout.LayoutParams' @Akash –
給'android.view.LinearLayout無法解析爲類型'。 – Geek