如何添加android zxing条码扫描tabbar?

时间:2014-01-18 22:19:27

标签: android cordova barcode-scanner

我有一个关于android zxing条码扫描phonegap的问题。我是一个新的Android应用程序开发人员。如何添加扫描仪视图标签栏?我之前正在搜索capture.xml布局文件,但是给了我错误。我该如何解决我的问题?请你能帮帮我一下吗? Capture.xml

<?xml version="1.0" encoding="UTF-8"?>
    <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <SurfaceView
    android:id="@+id/preview_view"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />


    <TabHost
    android:id="@+id/tabhost"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true" >

    <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <TabWidget
    android:id="@android:id/tabs"
    android:layout_width="match_parent"
    android:layout_height="108dp" >
    </TabWidget>

    <FrameLayout
    android:id="@android:id/tabcontent"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <LinearLayout
    android:id="@+id/tab1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    </LinearLayout>

    <LinearLayout
    android:id="@+id/tab2"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    </LinearLayout>

    <LinearLayout
    android:id="@+id/tab3"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    </LinearLayout>
    </FrameLayout>
    </LinearLayout>
    </TabHost>

    <com.google.zxing.client.android.ViewfinderView
    android:id="@+id/viewfinder_view"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />
    <LinearLayout
    android:id="@+id/result_view"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/result_view"
    android:baselineAligned="false"
    android:orientation="vertical"
    android:visibility="gone" >

    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:gravity="center"
    android:orientation="horizontal"
    android:padding="@dimen/standard_padding" >

    <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:gravity="right|center_vertical"
    android:orientation="vertical" >

    <ImageView
    android:id="@+id/barcode_image_view"
    android:layout_width="160dip"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/half_padding"
                android:adjustViewBounds="true"
                android:maxHeight="160dip"
                android:maxWidth="160dip"
                android:scaleType="centerInside" />

    <LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >
    <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingRight="@dimen/half_padding"
    android:text="@string/msg_default_format"
    android:textColor="@color/result_minor_text"
    android:textStyle="bold" />        
    </LinearLayout>
    </FrameLayout>

CaptureActivity.java

public void onCreate (Bundle icicle)  {
    super.onCreate(icicle);
    Window window = getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    setContentView(R.layout.capture);
    hasSurface = false;
    historyManager = new HistoryManager(this);
    historyManager.trimHistory();
    inactivityTimer = new InactivityTimer(this);
    beepManager = new BeepManager(this);
    PreferenceManager.setDefaultValues(this, R.xml.preferences, false);
    showHelpOnFirstLaunch();
}

onCreateFunction.butı我没有显示相机布局标签栏。

0 个答案:

没有答案