android:layout_weight水平均分怎么设置?

Atai-Lu Atai-Lu 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

<?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="166dp"
android:layout_marginBottom="6dp"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="139dp"
android:orientation="vertical"
android:background="#ffffff">
<ImageView
android:id="@+id/imageView"
android:scaleType="fitCenter"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="30dp"
android:orientation="vertical"
android:background="#e9e7e8">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@drawable/icon_heart"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center"
android:text="@string/heart"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@drawable/icon_talk"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center"
android:text="@string/talk"
/>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_weight="1">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@drawable/icon_share"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center"
android:text="@string/share"
/>
</LinearLayout>
</LinearLayout>

</LinearLayout>


这个为什么是垂直均分?
所有android:orientation="horizontal"删掉或者改成android:orientation="vertical"都一个效果...
android:layout_width
android:layout_height
改成各种值也还是弄不了水平均分........
...全文

相关推荐

线性布局的使用

线性布局的使用

wang_shuai_long

android_通讯录源码

很多人在找的基于android的通讯录源码

hxl8811

LinearLayout 线性布局

昨天那个bug还没找出来,害,先佛系度过,才刚开始不懂的很多我觉得没必要纠结这个bug太久,等我慢慢学多了再回头来看这个bug。 今天我买的书还没到,就在哔哩哔哩上找了一个up主进行学习。 一、LinearLayout 线性布局,代码如下 //离parent的左间距 //指在当前布局内的权限,为1,下面同理可得,两者权限都为1,所以平分了该布局 效果图如下 二、RelativeLayout 相对布局,代码如下: //指view_2在view_1的下面 //该布局离parent左右上下的间距为15dp 效果图如下 三、TextView 文本学了

weixin_38516804

Android layout_weight使用方法及实例

直接上代码和图片。 情况一:[html] 代码如下:&lt;?xml version=”1.0″ encoding=”utf-8″?&gt; <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:orientation=”horizontal”>     &lt;fragment         android:id=”@+id/tit

weixin_38691482

Android应用中通过Layout_weight属性用ListView实现表格

主要介绍了Android应用中通过Layout_weight属性用ListView实现表格的方法,文中对Layout_weight属性先有一个较为详细的解释,需要的朋友可以参考下

weixin_38691482
评论 4
收藏 已收藏
分享
返回顶部
Atai-Lu
Android 80,490 成员 91,375 内容