addView一个LinearLayout的布局显示有问题
下边这个是布局文件
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical"
android:fadingEdge="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/outerlayout"
android:orientation="vertical"
android:background="#374045"
android:paddingLeft="8dp"
android:paddingRight="8dp">
</LinearLayout>
</ScrollView>
下边这个是要添加到上边LinearLayout中的布局文件
<?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="90dp"
android:orientation="vertical">
<TextView android:id="@+id/singer_new_ttl"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:textSize="15sp"
android:textColor="#e1e1e1"
android:singleLine="false"/>
<TextView
android:id="@+id/tx_fromanddate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#808080"
android:textSize="13sp"/>
</LinearLayout>
问题是这样的,如果把下边的布局直接放到上边的LinearLayout中显示正常,比如只有一行文字也会显示90dp的高度,但是如果通过inflate下边的布局然后再addView到上边LinearLayout中就不会是固定的90dp,比如只有一行字那就只有一行的高度,这是为什么呢,一直没搞明白原因