我有以下带有LinearLayout的main.xml文件
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:weightSum="1" android:id="@+id/llid">
android:id="@+id/ProfileName"
android:layout_width="fill_parent"
android:textStyle="bold"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
android:id="@+id/Specs"
android:layout_width="fill_parent"
android:textStyle="bold"
android:layout_height="wrap_content"
android:gravity="center_horizontal">
我在运行时通过代码将图像添加到LinearLayout
ImageView image = new ImageView(this);
image.setImageBitmap(bmp);
LinearLayout ll = (LinearLayout) findViewById(R.id.llid);
ll.addView(image);
但是,我想在LinearLayout的2个TextView之间添加ImageView。 我似乎无法在android文档中找到在另一个视图之前或之后添加视图的方法。 我怎样才能做到这一点?
注意我打电话
setContentView(R.layout.main);
在将ImageView添加到LinearLayout之前。