Android ScanDit将文本视图(以XML格式)添加到裁剪的扫描视图

时间:2014-01-21 11:17:32

标签: android xml barcode barcode-scanner

我想在我的应用中使用Scandit条形码库。我按照教程,我决定使用裁剪扫描视图来获取条形码。在视图的剩余空间中,我想添加文本视图,我想在其中显示一些信息。在分离的布局xml视图中定义的所有内容(无编程);

我尝试使用Scandit SDK文档,但没有运气。有人能告诉我,我该怎么做?

感谢您的帮助。

Preview

1 个答案:

答案 0 :(得分:0)

如果您想要在演示图片中实现布局,可以使用此布局更改它,因为它符合您的要求。这将提供您想要实现的布局。您可以使用MainActivity方法在活动的onCreate() setContentView(R.layout.scanbar.xml);方法中设置此布局。这里的scanbar.xml是下面描述的布局。

scanbar.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/rl_main"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >



    <ImageView
        android:id="@+id/some"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginTop="58dp"
        android:background="@drawable/ic_about_us"
        android:padding="2dp" />

    <TextView android:id="@+id/text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/some"
        android:text="some text"
        android:padding="10dp"
        android:layout_centerInParent="true" />

</RelativeLayout>