質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

Q&A

解決済

1回答

3188閲覧

Zxingでのスキャン画面カスタマイズ方法

SIRYU

総合スコア10

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Android Studio

Android Studioは、 Google社によって開発された、 Androidのネイティブアプリケーション開発に特化した統合開発ツールです。

0グッド

0クリップ

投稿2018/11/27 05:59

先日Android Studioを触り始めた初心者です。
Zxingを使用してQRコードの読込みをしています。

読込み画面の大きさを変更しようとしているのですが、カスタマイズした読込み画面が表示されません。
原因が不明なためご教授いただければ幸いです。

//ボタンクリックで読込み画面起動
@Override
public void onClick(View aView) {
switch (aView.getId()) {
// SCAN
case R.id.button_scan2:
IntentIntegrator integrator = new IntentIntegrator(ScanMainActivity1.this);
integrator.setCaptureActivity(SmallCaptureActivity.class);←カスタマイズ画面
// スキャンするバーコード形式を指定
integrator.setDesiredBarcodeFormats(IntentIntegrator.QR_CODE);
// キャプチャ画面起動
integrator.initiateScan();
break;
default:
break;
}
}

//カスタマイズ画面(SmallCaptureActivity.java) ※zxing-android-embedded-master
import com.journeyapps.barcodescanner.CaptureActivity;
import com.journeyapps.barcodescanner.DecoratedBarcodeView;

/**

  • This activity has a margin.

*/
public class SmallCaptureActivity extends CaptureActivity {
@Override
protected DecoratedBarcodeView initializeContent() {
setContentView(R.layout.capture_small);
return (DecoratedBarcodeView)findViewById(R.id.zxing_barcode_scanner);
}
}

// capture_small.xml

<?xml version="1.0" encoding="UTF-8"?>

// Copyright (C) 2008 ZXing authors -- 中略
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:app="http://schemas.android.com/apk/res-auto" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".SmallCaptureActivity">

<com.journeyapps.barcodescanner.DecoratedBarcodeView android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" android:layout_alignParentTop="true" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginLeft="50dp" android:layout_marginRight="50dp" android:layout_marginTop="150dp" android:layout_marginBottom="150dp" android:id="@+id/zxing_barcode_scanner" app:zxing_use_texture_view="false" app:zxing_preview_scaling_strategy="fitXY"/>
</RelativeLayout>

// app/build.gradeへの追加
repositories {
mavenCentral();
maven {
url "http://dl.bintray.com/journeyapps/maven"
}
maven {
url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test🏃‍♂️1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
implementation 'com.google.zxing:core:3.3.2'
}

試したこと
・インターネット等での検索
・デザイン画面のパレットにデフォルトにないzxing_barcode_scannerをすることはNGなのでしょうか?
であればどうすればパレットにUIを追加できるのでしょうか?

補足情報(FW/ツールのバージョンなど)

・Wiondows 10 Pro 64bitOS
・javac 1.8.0_191
・Android Sudio 3.2.1
・Android Sudioにてプロキシの設定をしています。

AndroidManifest への追加
<activity android:name=".SubMainActivity1" />
<activity android:name=".ScanMainActivity1"></activity>

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

解決に至ったわけではありませんが、既に追加されているものを使用してみることにしましたので完了とさせて頂きます。

投稿2018/12/07 05:16

SIRYU

総合スコア10

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問