0
如果布局xml中的layout_width设置为fill_parent,是否可以获得线性/相对布局的宽度?例如,我有以下布局xml。是否有可能找到cameraSourceScreen的宽度?感谢提前:)获取线性/相对布局的宽度?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/CameraSourcesScreen"
>
<LinearLayout android:id="@+id/button_bar"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:background="@drawable/topbar"
android:orientation="horizontal"
android:gravity="center">
<LinearLayout android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:orientation="horizontal" android:paddingLeft="20dp">
<common.view.ToggleButton android:id="@+id/Near_Toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:text="@string/NEAR_STR"
android:textSize="18px" android:width="130dp"/>
<common.view.ToggleButton android:id="@+id/Far_Toggle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="2dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:text="@string/FAR_STR"
android:textSize="18px" android:width="130dp"/>
</LinearLayout> </LinearLayout> </RelativeLayout>
哇,不知道我能做到这一点...谢谢:) – iman453 2010-11-19 17:28:37
它不会在Android ICS +填充屏幕,因为有在底部的图形按钮栏。 – Fresheyeball 2012-10-30 15:13:48