安卓布局问题 整体是个 LinearLayout,中间当然要用一个 RelativeLayout 套一层了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我试过套一层RelativeLayout在中间,但是套了之后,下边的菜单栏就不见了 有几点没搞懂你的意思中间的LinearLayout和底部的RelativeLayout的外层的容器是什么,然后你把<RelativeLayout android:id="@+id/main" android:layout_width="fill_parent" android:layout_height="fill_parent" >是什么意思,底部menu干嘛要填充全部?下面是我根据我的理解写的<?xml version="1.0" encoding="UTF-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <!-- 中间图标 --> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" android:layout_centerInParent="true" /> <!-- 结束中间图标 --> <!-- 底部菜单 --> <LinearLayout android:id="@+id/bottom_panel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_alignParentBottom="true" > <include layout="@layout/umeng_socialize_actionbar"/> </LinearLayout> </RelativeLayout>我把中间的LinearLayout和下面的RelativeLayout去掉了,你看看 这么简单的布局,都不好意思拿分。<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > </LinearLayout> <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:src="@drawable/more_setting" /> </RelativeLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" > </LinearLayout></LinearLayout> 中间的LinearLayout和底部的RelativeLayout的外层是LinearLayout,底部的RelativeLayout我是在网上找的布局,可以把菜单固定在屏幕最底部 你这个布局最底的那个LinearLayout是不会固定在屏幕最底部的 可以用android:layout_centerInParent="true"属性<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity" > <RelativeLayout android:id="@+id/main" android:layout_width="100dp" android:layout_height="100dp" android:layout_centerInParent="true"> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ff0000" android:scaleType="fitXY" android:src="@drawable/dog" /> </RelativeLayout></RelativeLayout> 有3个属性1)android:layout_centerInParent是否垂直水平是否居中2)android:layout_centerHorizontal是否水平居中3)android:layout_centerVertical是否垂直居中 android启动第3方应用问题 Notification中怎么传值给下一个Activity 关于Expandablelistview的问题,请教高手! 如何在一个普通的View中得到输入的中文 最新版本的android支持哪些流媒体 Android画面间复杂类型参数传递问题 杀掉指定PID的进程 Android for eclipse plug in 不能下载 执行ifconfig配置ip后系统死机? android listview 绑定的adapter中,改变button的背景 安卓写出来的程序太卡 求教arcgis for android高手,导入arcgtisSDK问题。
中间的LinearLayout和底部的RelativeLayout的外层的容器是什么,然后你把<RelativeLayout
android:id="@+id/main"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >是什么意思,底部menu干嘛要填充全部?下面是我根据我的理解写的
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<!-- 中间图标 -->
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher"
android:layout_centerInParent="true"
/>
<!-- 结束中间图标 -->
<!-- 底部菜单 -->
<LinearLayout android:id="@+id/bottom_panel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_alignParentBottom="true" >
<include layout="@layout/umeng_socialize_actionbar"/>
</LinearLayout>
</RelativeLayout>
我把中间的LinearLayout和下面的RelativeLayout去掉了,你看看
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" > <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</LinearLayout> <RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/more_setting" /> </RelativeLayout> <LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" > </LinearLayout></LinearLayout>
中间的LinearLayout和底部的RelativeLayout的外层是LinearLayout,底部的RelativeLayout我是在网上找的布局,可以把菜单固定在屏幕最底部
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" > <RelativeLayout
android:id="@+id/main"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_centerInParent="true"> <ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ff0000"
android:scaleType="fitXY"
android:src="@drawable/dog" />
</RelativeLayout></RelativeLayout>
1)android:layout_centerInParent是否垂直水平是否居中
2)android:layout_centerHorizontal是否水平居中
3)android:layout_centerVertical是否垂直居中