How can i place dynamic image view over texture view?

瘦欲@ 提交于 2019-12-11 06:19:54

问题


This is my camera preview layout and i have a dynamic image view to show the thumbnail.I am not able to place the image view overlaping the texture view.How to do this??

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#000000">

    <LinearLayout
        android:id="@+id/thumbnails"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true">


    </LinearLayout>

    <TextureView
        android:layout_width="wrap_content"
        android:layout_height="453dp"
        android:id="@+id/textureView"
        android:layout_marginTop="80dp" />

    <ImageButton
        android:layout_width="59dp"
        android:layout_height="52dp"
        android:id="@+id/videoButton"
        android:contentDescription="@string/video_button"
        android:src="@mipmap/start_recording"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center_horizontal|bottom" />

    <Chronometer
        android:layout_width="129dp"
        android:layout_height="50dp"
        android:id="@+id/chronometer"
        android:visibility="invisible"
        android:textColor="#ff0000"
        android:textSize="25sp"
        android:layout_centerHorizontal="true"
        android:layout_gravity="left|bottom" />

</FrameLayout>

This is my code for creating dynamic image view.

LinearLayout layout = (LinearLayout) findViewById(R.id.thumbnails);
bitMapIndex = 0;
if (layout.getChildCount() > 0) {
    layout.removeAllViews();
}
for (Bitmap eachBitMap : bitMapsAvailable) {    
    bitMapIndex++;
    ImageView thumb = new ImageView(this);
    thumb.setId(new Integer(bitMapIndex+ 17));
    thumb.setLayoutParams(new android.view.ViewGroup.LayoutParams(100, 80));
    thumb.setImageBitmap(eachBitMap);
    // Adds the view to the layout
    thumb.setOnClickListener(previewThumb(thumb));
    layout.addView(thumb);
}

来源:https://stackoverflow.com/questions/41827306/how-can-i-place-dynamic-image-view-over-texture-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!