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

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

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

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

Q&A

解決済

1回答

288閲覧

AlertDialogによる画像の埋め込み及び位置取り

Zodiarc

総合スコア19

Android

Androidは、Google社が開発したスマートフォンやタブレットなど携帯端末向けのプラットフォームです。 カーネル・ミドルウェア・ユーザーインターフェイス・ウェブブラウザ・電話帳などのアプリケーションやソフトウェアをひとつにまとめて構成。 カーネル・ライブラリ・ランタイムはほとんどがC言語/C++、アプリケーションなどはJavaSEのサブセットとAndroid環境で書かれています。

0グッド

0クリップ

投稿2018/09/27 07:15

お世話になっております。

Android開発初心者です。
AlertDialogにて画像の埋め込みと位置の調節をしたく質問をいたしました。
以下の画像のようにAlertDialogを表示しました。

イメージ説明

上記の位置取りを一行にしたいのですがパーツの仕組みを理解しておらず
うまく実装できていない状況です。
円になっている個所を「設定確認中…」の左右どちらかに配置したいです。

前提として
・ProgressDialogはAndroid8.0にて非推奨となりましたので使用しない

表示のソースと画像のxmlを添付いたします。
ご存じあればご教示お願いいたします。

AlertDialog

1 /** 設定待ちダイアログ. */ 2 public static class ProgressDialogFR extends DialogFragment { 3 /** ダイアログメッセージ用。setArguments時のキー. */ 4 private static final String MESSAGE = "message"; 5 6 /** 7 * 新しいインスタンスを作成する. 8 * @param msg ダイアログメッセージ 9 * @return ProgressDialogFR 10 */ 11 public static ProgressDialogFR newInstance(final String msg) { 12 ProgressDialogFR fragment = new ProgressDialogFR(); 13 Bundle args = new Bundle(); 14 fragment.setCancelable(false); 15 args.putString(MESSAGE, msg); 16 fragment.setArguments(args); 17 //fragment. 18 return fragment; 19 } 20 21 @Override 22 public final Dialog onCreateDialog(final Bundle savedInstanceState) { 23 AlertDialog.Builder builder = new AlertDialog.Builder(getActivity(), R.style.AppThemeBlackDialog); 24 25 LayoutInflater inflater = getActivity().getLayoutInflater(); 26 27 View view = inflater.inflate(R.layout.dialog_progress, null); 28 builder.setView(view); 29 builder.setMessage(getArguments().getString(MESSAGE)); 30 return builder.create(); 31 } 32 }

dialog

1<?xml version="1.0" encoding="utf-8"?> 2<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:app="http://schemas.android.com/apk/res-auto" 4 android:layout_width="wrap_content" 5 android:layout_height="wrap_content"> 6 7 <ProgressBar xmlns:android="http://schemas.android.com/apk/res/android" 8 android:id="@+id/progress" 9 android:layout_width="80dp" 10 android:layout_height="80dp" 11 android:layout_gravity="center" 12 android:layout_marginLeft="16dp" 13 android:layout_marginTop="16dp" 14 app:layout_constraintLeft_toLeftOf="parent" 15 app:layout_constraintTop_toTopOf="parent" 16 app:layout_constraintBottom_toBottomOf="parent" 17 android:layout_marginBottom="16dp" /> 18</android.support.constraint.ConstraintLayout>

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

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

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

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

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

guest

回答1

0

自己解決

自己解決いたしました。

setupmessageに入れるのではなく
TextView mMessageTextView = view.findViewById(R.id.progress_message);
mMessageTextView.setText(getArguments().getString(MESSAGE));
のようにして

dialogにprogress_messageを追加して以下の文言を加えて可能になりました。
<TextView android:id="@+id/progress_message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginStart="16dp" app:layout_constraintBottom_toBottomOf="@+id/progress" app:layout_constraintLeft_toRightOf="@+id/progress" app:layout_constraintTop_toTopOf="@+id/progress" app:layout_constraintVertical_bias="0.5" />

投稿2018/09/27 07:47

Zodiarc

総合スコア19

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問