TL; DR:のTextViewの簡単なandroid:drawableLeft
機能を使用するとクラッシュテキストの隣に画像がありますか?
TextView
は、Androidの最も基本的な視覚的な要素の一つであるにつながります。それでは、基本機能が動作していないのはなぜですか?
https://developer.android.com/reference/android/widget/TextView.html#attr_android:drawableLeft
私のコードは単純ではあるTextView
に次の画像を使用して、カスタムダイアログです:
<TextView
android:text="Text next to check mark"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView19"
android:drawableLeft="@drawable/ic_check_circle_white_24dp"
android:textSize="24sp"
android:textStyle="normal|bold"/>
コードはビジュアルエディタ上で見事な結果を提供します:
しかし、実際にプログラムがex ecuted、シンプルandroid:drawableLeft
機能は、アプリをクラッシュ:
android.view.InflateException: Binary XML file line #64: Error inflating class TextView
私はそうのようなダイアログを開いてみてください:
dialog = new Dialog(this,R.style.Theme_AppCompat_Light_Dialog_Alert);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.premium_dialog);
dialog.setCanceledOnTouchOutside(false);
dialog.getWindow().setLayout((int) (getResources().getDisplayMetrics().widthPixels * 0.90), (int) (getResources().getDisplayMetrics().heightPixels * 0.90));
dialog.show();
なぜそれが、このような基本的な機能があるということですInflateException
の原因(TextViewを削除するとエラーがなくなるため、問題の原因となっているdrawableLeft
関数です)
色状態リストリソースのID番号の0x7f020011'から** **のres /描画可能/ abc_dialog_material_background.xmlファイル –
'vectordrwable'をより低いAPIの' Textview'で直接使用することはできません。下位APIのベクトルをサポートするCustomTextviewを作成する –