カスタムを含む設定画面がありますDialogPreference
:
<com.company.project.AboutDialog
android:key="about_dialog"
android:icon="@drawable/logo"
android:title="About Company Project"
android:summary="Version information"
android:dialogLayout="@layout/about_dialog"
android:negativeButtonText=""
/>
ご覧のとおり、dialogLayout
プロパティを使用してこのカスタム ダイアログにレイアウトを適用しています。TextView
このレイアウト内の a への参照を my から取得したいのですが、DialogPreference
どこから取得すればよいかわかりません:
public class AboutDialog extends DialogPreference {
@Override
protected void onPrepareDialogBuilder(Builder builder) {
// Hide the title from the dialog
builder.setTitle(null);
super.onPrepareDialogBuilder(builder);
/*
* Where do I find a context for findViewById?
* ((TextView)findViewById(R.id.version)).setText("Hello, world");
*/
}
public AboutDialog(Context context, AttributeSet attrs) {
super(context, attrs);
}
}