【发布时间】:2014-02-09 02:29:54
【问题描述】:
我有如下布局。现在,我不想将相对布局的宽度设置为固定的 240 dp。我想将相对布局的宽度设置为屏幕宽度的 1/3。是否可以在 xml 文件中执行此操作。如果不可能,我该如何使用 java 代码来实现呢?
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/fullscreen"
style="@style/translucent">
<RelativeLayout
android:layout_width="240dp"
android:layout_height="fill_parent"
android:layout_gravity="right"
android:gravity="center"
android:background="#88000000"
android:id="@+id/sidebar">
</RelativeLayout>
</FrameLayout>
【问题讨论】:
标签: android android-layout width android-relativelayout