9
내가 지원 라이브러리 및 도구 모음에 대한 예를 일하고

이 그것은 내가이 ?attr을 볼 처음으로 안드로이드 문서Android에서 attr/mean은 무엇입니까?

<android.support.v7.widget.Toolbar 
    android:id="@+id/my_toolbar" 
    android:layout_width="match_parent" 
    android:layout_height="?attr/actionBarSize" 
    android:background="?attr/colorPrimary" 
    android:elevation="4dp" 
    android:theme="@style/ThemeOverlay.AppCompat.ActionBar" 
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/> 

에 레이아웃의 코드이며, 나는 그들이 무엇을 의미하는지에 대한 단서가 없다 또는이 값들이 저장된 위치. 이러한 맞춤 설정은 Android 프레임 워크에 미리 정의되어 있습니까?

참조 : 속성에 Android Toolbar Documentation

답변

9

?attr/ 참조. 속성은 앱 테마에 지정된 값입니다. 예제의 특정 속성은 지원 라이브러리가 제공하는 주제에 지정된 모든 값입니다. Android는 자체 속성도 가지고 있으므로 ?android:attr/으로 사용할 수 있습니다.

경우에 따라 쉽게 사용자 정의 할 수 있으므로 값 대신 속성 값을 직접 사용하는 것이 좋습니다. 예를 들어 맞춤보기를 만들 때 ?attr/colorAccent을 사용하면보기 사용자가 색상을 제공 할 필요가 없으며 대신 앱 테마에 사용 된 colorAccent을 사용하게됩니다.

관련 문제