androiddrawable에서 사용자 정의 xml 파일 여러 가지 형식 집합
<shape android:shape="oval" xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/colorPrimary" />
<corners android:topLeftRadius="10dp"
android:topRightRadius="10dp"
android:bottomLeftRadius="10dp"
android:bottomRightRadius="10dp"
/>
shape>
2、원각textview
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#fff7f3" />
<corners
android:bottomLeftRadius="4dp"
android:bottomRightRadius="4dp"
android:topLeftRadius="4dp"
android:topRightRadius="4dp" />
shape>
3. 버튼 클릭 효과 선택
<selector xmlns:android="http://schemas.android.com/apk/res/android" android:enterFadeDuration="@android:integer/config_shortAnimTime" android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:state_pressed="true">
<shape>
<solid android:color="@color/colorPrimaryDark"/>
shape>
item>
<item android:state_focused="true">
<shape>
<solid android:color="@color/colorPrimaryDark"/>
shape>
item>
<item>
<shape>
<solid android:color="@color/colorPrimary"/>
shape>
item>
selector>
4、checkbox 선택, 미선택, 사용자 정의 그림
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/cb_selected" android:state_checked="true"/>
<item android:drawable="@mipmap/cb_selected" android:state_selected="true"/>
<item android:drawable="@mipmap/cb_selected" android:state_pressed="true"/>
<item android:drawable="@mipmap/cb_unselected"/>
selector>
5. 높이를 지정하고 가로줄, 세로줄을 그린다.
<shape
android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<size android:height="@dimen/divider_line_height_small"/>
<solid android:color="@color/divider"/>
shape>
:
<shape
android:shape="rectangle"
xmlns:android="http://schemas.android.com/apk/res/android">
<size android:width="@dimen/divider_line_height_small"/>
<solid android:color="@color/divider"/>
shape>
6, SVG는 벡터 그래프 형식으로 Scalable Vector Graphics 세 단어의 알파벳 줄임말이다.xml 파일의 탭은 그림이 일반적인 그림 자원처럼 사용할 수 있다는 것입니다
"http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportHeight="32.0"
android:viewportWidth="32.0">
"#666"
android:pathData="m31.84 13.35c-0.31 0.57 -1 0.76 -1.54 0.43l-1.01 -0.61c-0.42 0.9 -0.98 1.86 -1.73 2.77l0.91 0.95c0.44 0.46 0.44 1.21 0 1.67c-0.44 0.46 -1.16 0.46 -1.6 0l-0.93 -0.97c-0.9 0.76 -2 1.43 -3.3 1.96l0.34 1.33c0.16 0.63 -0.2 1.28 -0.8 1.45c-0.6 0.17 -1.22 -0.21 -1.38 -0.84l-0.32 -1.24c-0.99 0.24 -2.08 0.41 -3.27 0.49v2.04c0 0.66 -0.5 1.2 -1.11 1.2c-0.61 0 -1.11 -0.54 -1.11 -1.2v-2.1c-1.36 -0.14 -2.56 -0.4 -3.64 -0.75l-0.38 1.52c-0.16 0.64 -0.77 1.02 -1.36 0.85c-0.59 -0.17 -0.94 -0.83 -0.78 -1.47l0.43 -1.75c-1.14 -0.59 -2.1 -1.3 -2.89 -2.06l-1.35 1.47c-0.43 0.47 -1.13 0.47 -1.57 0c-0.43 -0.47 -0.43 -1.23 0 -1.7l1.41 -1.52c-0.65 -0.92 -1.13 -1.85 -1.48 -2.72l-1.72 1.08c-0.53 0.33 -1.21 0.13 -1.51 -0.44c-0.31 -0.57 -0.12 -1.31 0.41 -1.64l1.92 -1.2c0.06 -0.04 0.13 -0.07 0.2 -0.1c-0.1 -0.45 -0.16 -0.81 -0.19 -1.07h-0.04c0 -0.07 0.01 -0.13 0.02 -0.2c-0.01 -0.13 -0.02 -0.2 -0.02 -0.2h0.07c0.15 -0.46 0.56 -0.8 1.04 -0.8c0.48 0 0.89 0.34 1.04 0.8h0.07c2.22 9.69 11.82 9.6 11.82 9.6c0 0 9.6 -0 11.82 -9.59h0.06c0.15 -0.47 0.56 -0.81 1.04 -0.81c0.49 0 0.89 0.34 1.04 0.81h0.07c0 0 -0.01 0.07 -0.02 0.2c0.01 0.06 0.02 0.13 0.02 0.19h-0.04c-0.05 0.37 -0.15 0.98 -0.36 1.74l1.32 0.8c0.54 0.33 0.73 1.05 0.41 1.62z"/>
, 。 , PathData :
android:pathData="M22,16V4c0,-1.1 -0.9,-2 -2,-2H8c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2zm-11,-4l2.03,2.71L16,11l4,5H8l3,-4zM2,6v14c0,1.1 0.9,2 2,2h14v-2H4V6H2z" />
http://www.cnblogs.com/yuhanghzsd/p/5466846.html
7. rating bar 사용자 정의 그림, 공백-반성-전성
list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@android:id/background"
android:drawable="@mipmap/ic_empty_star" />
<item
android:id="@android:id/secondaryProgress"
android:drawable="@mipmap/ic_half_star" />
<item
android:id="@android:id/progress"
android:drawable="@mipmap/ic_star" />
list>
8、xml에서 다른 xml을 인용
1、
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/laevatein_button_background_count_pressed" android:state_pressed="true"/>
<item android:drawable="@drawable/laevatein_button_background_count_disable" android:state_enabled="false"/>
<item android:drawable="@drawable/laevatein_button_background_count_normal"/>
selector>
1:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="6dp"/>
<solid android:color="@color/colorPrimaryDark"/>
shape>
item>
layer-list>
2:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="6dp"/>
<solid android:color="#bbbbbb"/>
shape>
item>
layer-list>
3:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<corners android:radius="6dp"/>
<solid android:color="@color/colorPrimary"/>
shape>
item>
layer-list>
9、button 클릭 효과 전면
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true" android:state_focused="true" android:state_pressed="false">
<shape>
<solid android:color="#e0b419" />
<corners android:radius="12dp"/>
shape>
item>
<item android:state_enabled="true" android:state_pressed="true">
<shape>
<solid android:color="#e0b419" />
<corners android:radius="12dp"/>
shape>
item>
<item android:state_checked="true" android:state_enabled="true">
<shape>
<solid android:color="#e0b419" />
<corners android:radius="12dp"/>
shape>
item>
<item android:state_enabled="false">
<shape>
<solid android:color="#bbbbbb" />
<corners android:radius="12dp"/>
shape>
item>
<item>
<shape>
<solid android:color="#e0b419" />
<corners android:radius="12dp"/>
shape>
item>
selector>
10, 색상 그라데이션, 어느 각도에서 시작, 기본 왼쪽 - 오른쪽
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="@color/white"
android:endColor="@color/line_shadow"
android:angle="270"
/>
shape>
android:angle
Integer, , 0 is left to right, 90 is bottom to top. 45 .
http://blog.csdn.net/zjdyhant/article/details/46537647
11. 원반경 5dp 그리기
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid android:color="@color/red" />
<size
android:width="10dp"
android:height="10dp" />
shape>
12. 사운드 크기 애니메이션
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@mipmap/progress_voice_01"
android:duration="500" />
<item
android:drawable="@mipmap/progress_voice_02"
android:duration="500" />
<item
android:drawable="@mipmap/progress_voice_03"
android:duration="500" />
animation-list>
13、radio button
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@mipmap/radio_bt_selected" android:state_checked="true" />
<item android:drawable="@mipmap/radio_bt_selected" android:state_selected="true" />
<item android:drawable="@mipmap/radio_bt_selected" android:state_pressed="true" />
<item android:drawable="@mipmap/radio_bt_unselected" />
selector>
14. 그라데이션 왼쪽-오른쪽
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:angle="0"
android:endColor="?attr/colorPrimary"
android:startColor="?attr/colorAccent"/>
shape>
15.item 클릭 변색
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/grey_light" android:state_pressed="true" />
<item android:drawable="@color/grey_light" android:state_selected="true" />
<item android:drawable="@android:color/transparent" />
selector>
16.progressbar 진행률 표시줄과 배경
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@android:id/background">
<shape>
<solid android:color="#00000000" />
shape>
item>
<item android:id="@android:id/progress">
<clip>
<shape>
<gradient
android:angle="0"
android:endColor="?attr/colorPrimary"
android:startColor="?attr/colorAccent"/>
shape>
clip>
item>
layer-list>
:
<ProgressBar
android:id="@+id/progress_bar"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="4dp"
tools:progress="20"
android:progressDrawable="@drawable/web_progressbar"
/>
17.button 선택 효과 전면
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="true" android:state_focused="true" android:state_pressed="false">
<shape>
<gradient android:angle="0" android:endColor="?attr/colorPrimary" android:startColor="?attr/colorAccent" />
<corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
shape>
item>
<item android:state_enabled="true" android:state_pressed="true">
<shape>
<gradient android:angle="0" android:endColor="@color/colorPrimaryPressed" android:startColor="@color/colorAccentPressed" />
<corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
shape>
item>
<item android:state_checked="true" android:state_enabled="true">
<shape>
<gradient android:angle="0" android:endColor="@color/colorPrimaryPressed" android:startColor="@color/colorAccentPressed" />
<corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
shape>
item>
<item android:state_enabled="false">
<shape>
<gradient android:angle="0" android:endColor="@color/colorPrimaryDisabled" android:startColor="@color/colorAccentDisabled" />
<corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
shape>
item>
<item>
<shape>
<gradient android:angle="0" android:endColor="?attr/colorPrimary" android:startColor="?attr/colorAccent" />
<corners android:bottomLeftRadius="5dp" android:bottomRightRadius="5dp" android:topLeftRadius="5dp" android:topRightRadius="5dp" />
shape>
item>
selector>
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.