一个关于android布局的问题!

月盡天明
博客专家认证
2014-10-29 03:20:54
<LinearLayout
android:id="@+id/home_left_menu_id"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#A3A3A3"
android:orientation="vertical" >



<LinearLayout
android:id="@+id/home_left_menu1_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#836FFF"
android:orientation="horizontal" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#09ff00"
android:layout_weight="1" >

<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerInside"
android:layout_marginLeft="15dip"
android:layout_gravity="center_vertical"
android:src="@drawable/shouye" />

</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#0ff0ff"
android:gravity="center_vertical"
android:layout_marginLeft="10dip"
android:orientation="vertical"
android:layout_weight="1" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/home_ch"
android:textColor="#ffffff"
android:textSize="17sp" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/home_en"
android:textColor="#ffffff"
android:textSize="10sp" />
</LinearLayout>

</LinearLayout>



<LinearLayout
android:id="@+id/home_left_menu2_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#7D26CD"
android:orientation="vertical" >
</LinearLayout>


<LinearLayout
android:id="@+id/home_left_menu3_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#CD0000"
android:orientation="vertical" >
</LinearLayout>



<LinearLayout
android:id="@+id/home_left_menu4_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#B3EE3A"
android:orientation="vertical" >
</LinearLayout>


<LinearLayout
android:id="@+id/home_left_menu5_id"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#A4D3EE"
android:orientation="vertical" >
</LinearLayout>
</LinearLayout>



以上是我的布局文件,放置图片和问题的那个layout被撑大了,请教一下,该怎么设置呢?

我这一段布局是一些 菜单,包括图片和文字,采用哪种布局更合适呢?
...全文
285 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
majaw 2014-10-29
  • 打赏
  • 举报
回复
android:layout_weight用的太多了,使用了layout_weight后,如果 是水平方向,则layout_width的宽度不生效。

80,337

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧