平时看代码比较多,写的很少,今天写了一个简单的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的源码,额,有点复杂,目前水平还理解不了。。。
所有先记下来,以后再慢慢分析。。。谁知道的也可以跟俺讲讲,不胜感激~