我正在编码一些滑块,该视图获得其子级,但没有任何显示。
构造函数代码
Elements images = doc.getElementsByClass("bimg");
llds = (LinearLayout)detailarticle.findViewById(R.id.imagesarticle) ;
lld=(LinearLayout) detailarticle.findViewById(R.id.imagearticlelo);
lld.removeAllViews();
lld.setOrientation(LinearLayout.HORIZONTAL);
for(Element img:images){
LayoutInflater inflater = getLayoutInflater();
View lldView = inflater.inflate(R.layout.image_detail, lld, false);
ImageView image_v = (ImageView)lldView.findViewById(R.id.imagearticle);
...
image_v.setImageBitmap(BitmapFactory.decodeByteArray(art.getImage(image_s),
0, art.getImage(image_s).length));
llds.addView(lldView);
}
detailarticle是父布局,它包含一些文本视图和此滑块
图像布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/imagearticlelo"
android:layout_width="350dp"
android:layout_height="190dp"
android:orientation="horizontal"
>
<ImageView
android:id="@+id/imagearticle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginBottom="5dp"
app:srcCompat="@android:drawable/ic_info" />
</LinearLayout>
父级布局:
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scrollbars="horizontal">
<LinearLayout
android:id="@+id/imagesarticle"
android:layout_width="wrap_content"
android:layout_height="200dp"
android:orientation="horizontal">
<include layout="@layout/image_detail" />
</LinearLayout>
</ScrollView>
并在主菜单中:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/detailArticle"
>
<include layout="@layout/detailarticle_layout" />
</LinearLayout>
lldView正在获取其图像视图