以前に問題なくこれを行ったことがあるので、私の間違いが微妙であることはわかっています。
picker_dialog_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="left|center_horizontal"
android:id="@+id/pickerDialog_title"
android:text="HELLO WORLD!!"/>
<NumberPicker
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/pickerDialog_title"
android:id="@+id/pickerDialog_selector"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignTop="@+id/pickerDialog_selector"
android:orientation="horizontal">
<Button
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="5"
android:id="@+id/pickerDialog_cancel"
android:gravity="center"
android:text="Cancel"/>
<Button
android:layout_height="match_parent"
android:layout_width="0dp"
android:layout_weight="5"
android:id="@+id/pickerDialog_set"
android:gravity="center"
android:text="Set"/>
</LinearLayout>
</merge>
カスタムクラスのコンストラクター中に、次をPickerDialog(Context context, AttributeSet attrs, int defStyle)
呼び出します。
LayoutInflater.from(context).inflate(R.layout.picker_dialog_layout, this);
親 XML では、次のようになります。
<com.company.simonaddicott.controlpanel_1.PickerDialog
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/pickerDialog" />
ビュー自体は表示され、開発者ツールでレイアウト バインド ツールを使用すると、UI 要素が存在するか、少なくとも境界が存在することを識別できます (以下を参照)。
UI要素が本来のように表示されるようにするために、これには何が欠けていますか??