LinearLayout中layout_weight的一点问题

平时看代码比较多,写的很少,今天写了一个简单的activity来显示call log

结果就出现了一个问题,button怎么都不会显示出来,布局如下:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
	android:layout_width="match_parent"
	android:layout_height="match_parent"
	android:orientation="vertical">
	<ListView
	android:id="@+id/calllog_list"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	/>

	<Button
	android:id="@+id/button_ok"
	android:layout_width="match_parent"
	android:layout_height="wrap_content"
	android:paddingBottom="5dip"
	/>
</LinearLayout>
找了很多方法都无果,后来在电话本的源码里看到一个类似的,在ListView的属性里加个:android:layout_weight="1"

然后就神奇了,问题解决了!

在网上查也没查到为什么,无果。

看LinearLayout的源码,额,有点复杂,目前水平还理解不了。。。

所有先记下来,以后再慢慢分析。。。谁知道的也可以跟俺讲讲,不胜感激~


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值