私は好みのアンドロイドを持っています:レイアウトgft。 xmlファイルの設定のアンドロイド:レイアウトプロパティでレイアウトを設定しました。カスタムレイアウトの設定の表示を取得
レイアウトのボタンを初期化する必要があります(+1ボタン)。 ボタンをonCreateメソッド(+1ボタン)で取得する必要がありますが、findViewById(button_id)
を使用するとnullが返されます。
この設定を表示する方法はありますか?
UPDATE:それは私が好みのXMLを追加した後に作成されていない好みのように思えるので、私はnullを取得します。 findViewByIdをどこで呼び出せば、ボタンはすでに作成されていますか?
ありがとうございました。
環境設定のxml:
<Preference android:title="Rate this app"
android:key="rate"
android:widgetLayout="@layout/plusone_pref"/>
</PreferenceScreen>
好みのレイアウトのxml:
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.gms.plus.PlusOneButton xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:plus="http://schemas.android.com/apk/lib/com.google.android.gms.plus"
android:id="@+id/plus_one_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:focusable="false"
plus:size="standard" />