Style Android: Różnica między „style =„ @ android: style / XYZ ”” i „style =„? Android: attr / XYZ ””?
Staram się stylizować przyciski, aby wyglądały jak te, o które pytamAndroid Pełna szerokość stylu ICS Minimalistyczne przyciski dolneWyświetlane.
Udało mi się, korzystając z następującego pliku XML dla wszystkich zainteresowanych:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:divider="@android:drawable/divider_horizontal_dark"
android:gravity="bottom"
android:orientation="vertical"
android:paddingTop="16dip"
android:showDividers="beginning|end" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:measureWithLargestChild="true"
android:orientation="horizontal"
android:divider="@android:drawable/divider_horizontal_dark"
android:showDividers="middle" >
<Button
android:id="@+id/cancel_button"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_weight="1"
android:maxLines="2"
android:text="@string/cancel_button" />
<Button
android:id="@+id/login_button"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_weight="1"
android:filterTouchesWhenObscured="true"
android:maxLines="2"
android:text="@string/login_button" />
</LinearLayout>
</LinearLayout>
Jedno pytanie jednak. Asystent treści Zaćmienie nie ma pojęcia, co dzieje się z następującą rozdzielczością zasobów:
style="?android:attr/buttonBarButtonStyle"
Jestem zaznajomiony z typową rozdzielczością (o której świadczy pomoc dla treści Eclipse)
style=@android/style/...
... ale nie jestem pewien co do różnicy między nimi. Wygląda na to, że niektóre atrybuty stylu pojawiają się w jednym, ale nie w drugim. Na przykład poniższe nie rozwiązuje niczego:
style=@android:attr/buttonBarStyle
tak samo nie jest:
style="@android:style/buttonBarStyle
Zgaduję więc dwa pytania:
Dlaczego różnica w składni odniesień do zasobów?Dlaczego myląca klasyfikacja stylów w kategorii attr.Do czego jeszcze służy kategoria attr?Dzięki!