Android 布局问题提出
这是我的布局文件::Android 布局问题提出,android,Android,这是我的布局文件:: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout android:id="@+id/relativeLayout1"
android:layout_width="wrap_content" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/bg1"
>
<!-- <RelativeLayout android:id="@+id/relativeLayo"
android:layout_width="480dp" android:layout_height="320dp"
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_marginLeft="20dp"
android:background="@drawable/bg1"> -->
<ImageView android:src="@drawable/lets_play"
android:layout_width="wrap_content" android:layout_marginLeft="260dp"
android:id="@+id/imageView1" android:layout_height="wrap_content"
android:layout_marginTop="40dp"
></ImageView>
<ImageView android:src="@drawable/show_me"
android:layout_width="wrap_content" android:layout_marginLeft="220dp"
android:id="@+id/imageView1" android:layout_height="wrap_content"
android:layout_marginTop="60dp"
></ImageView>
<ImageButton android:id="@+id/anim_btn_play"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="260dp" android:layout_marginTop="150dp"
android:src="@drawable/play">
</ImageButton>
</RelativeLayout>
和移动输出类似::
!![此][1]
现在我的问题是::我想设置480*320大小的屏幕,布局从左开始。在右边还有黑色部分。我有大约十个活动,所有活动都将显示相同的方向。现在我想在中心展示如下内容::
![此][2]
那么您能告诉我解决方案吗?最简单的方法是用其他东西包装您的相对布局,也许线性布局可以,然后:
<linearlayout gravity=center>
<relativelayout width=480dp height=320dp>
...
...
它可以快速解决您在特定480x320屏幕上的问题
<>但是,我建议你重新考虑一下你的背景图像,以便有可能采用不同长宽比的屏幕,考虑看,使背景“STRACTHECTREST”或定制一个可以停留在屏幕中间的绘制。