Tercihim var android: layout gft. Düzeni, xml dosyasındaki tercihin android: layout özelliğine ayarladım.Özel düzen ile tercih görünümüne göz atın
Şimdi, düzende bir düğmenin başlatılması gerekiyor (bu bir +1 düğmesi). Bu düğmeyi onCreate yönteminde almam gerekiyor (bu bir +1 düğmesi), ancak findViewById(button_id)
kullandığımda, null değerini döndürür.
Bu tercihin görünümünü elde etmenin bir yolu var mı?
UPDATE: Tercihi xml ekledikten sonra tercih oluşturulmuyor gibi görünüyor, bu yüzden boş olurum. FindViewById'i arayabileceğim yer bu yüzden düğme zaten oluşturuldu mu?
Teşekkürler.
Tercihler xml:
<Preference android:title="Rate this app"
android:key="rate"
android:widgetLayout="@layout/plusone_pref"/>
</PreferenceScreen>
Tercih düzeni xml: Daha sonra, Preference
uzanan bir sınıf oluşturmak onBindView
geçersiz kılmak gerekiyor ve erişebileceksiniz
<?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" />