首页 文章

Wikitude在扫描图像上创建图像叠加

提问于
浏览
0

我想在从wikitude cloud成功识别图像后在目标图像上显示一个图像 . 我已经使用了由sdk提供的点击wikitude Cloud 识别示例代码 . 如何使用原生android sdk实现这一目标?

1 回答

  • 0

    如果您更喜欢使用xml,请尝试以下方法:

    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
       android:orientation="vertical"
       android:layout_width="match_parent"
       android:layout_height="match_parent">
       <ImageView
            android:id="@+id/image1"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:src="@drawable/image1"/>
       <ImageView
            android:id="@+id/image2"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:src="@drawable/image2"/>
    </FrameLayout>
    

    如果您使用的是代码,请尝试以下方法:

    FrameLayout frame = (FrameLayout) findViewById(R.id.frame);
    ImageView image1 = ...
    ImageView image2 = ...
    
    
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            layoutParams.gravity = Gravity.RIGHT | Gravity.TOP;
    i.setLayoutParams(layoutParams); 
    frame.addView(image1);
    frame.addView(image2);
    

相关问题