Android 용 앱 개발을 위해 Android Studio를 사용하고 있습니다. 내가 내 스타일의 자원을 가지고 .../SRC/메인/입술/값 -Android @style 리소스가 해결되지 않았습니다.
colors.xml
dimens.xml
strings.xml
styles.xml
나는 Styles.xml 파일에 정의 된 스타일의 몇 가지있다
와 스튜디오가 말하는 오류가 발생합니다 그 스타일은 할 수 없습니다 동일 Activity 코드와 동일한 styles.xml 파일에서 하나의 LinearLayout에 해석되어 적용되는 곳에서 해결되어야합니다. 작동하는 LinearLayout 내의 다른 스타일을 Button에 적용하려고합니다.
<style name="LoginButton">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginTop">10dp</item>
<item name="android:layout_marginLeft">25dp</item>
<item name="android:layout_marginRight">25dp</item>
<item name="android:background">@color/navy_blue</item>
<item name="android:textColor">@color/white</item>
<item name="android:text">@string/action_sign_in</item>
<item name="android:paddingLeft">50dp</item>
<item name="android:paddingRight">50dp</item>
<item name="android:layout_gravity">center</item>
</style>
그리고 activity_login.xml에 - - 스타일에
<Button style="@style/LoginButton"
android:id="@+id/sign_in_button"
/>
오류 안드로이드 스튜디오 보여줍니다 -
Rendering Problems NOTE: One or more layouts are missing the layout_width or layout_height attributes. These are required in most layouts. <Button> does not set the required layout_width attribute: Set to wrap_content, Set to match_parent <Button> does not set the required layout_height attribute: Set to wrap_content, Set to match_parent Or: Automatically add all missing attributes Couldn't resolve resource @style/LoginButton (6 similar errors not shown)
더 많은 코드를 게시 하시겠습니까? –
질문에 – kalehv
코드 스 니펫을 추가하면 버튼에 'android : layout_width' 및'android : layout_height '만 이동하면됩니다. 안드로이드는 스타일에서 항상이 필드를 읽지는 않습니다. – nfirex