2019년 7월 26일 금요일

circularImageView-안드로이드에서 간단하게 원형 이미지 생성

Web site
https://github.com/lopspower/CircularImageView

build.gradle(Module:app)에 추가
1
2
3
dependencies {
    implementation 'com.mikhaellopez:circularimageview:4.0.1'
}

Properties
  • app:civ_circle_color (color) -> default WHITE
  • app:civ_border (boolean) -> default true
  • app:civ_border_color (color) -> default WHITE
  • app:civ_border_width (dimension) -> default 4dp
  • app:civ_shadow (boolean) -> default false
  • app:civ_shadow_color (color) -> default BLACK
  • app:civ_shadow_radius (float) -> default 8.0f
  • app:civ_shadow_gravity (center, top, bottom, start or end) -> default bottom

XML
1
2
3
4
5
6
7
8
9
<com.mikhaellopez.circularimageview.CircularImageView
        android:layout_width="250dp"
        android:layout_height="250dp"
        android:src="@drawable/image"
        app:civ_border_color="#3f51b5"
        app:civ_border_width="4dp"
        app:civ_shadow="true"
        app:civ_shadow_radius="10"
        app:civ_shadow_color="#3f51b5"/>

JAVA

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
CircularImageView circularImageView = findViewById(R.id.circularImageView);
// Set Circle color for transparent image
circularImageView.setCircleColor(Color.WHITE);
// Set Border
circularImageView.setBorderColor(Color.RED);
circularImageView.setBorderWidth(10);
// Add Shadow with default param
circularImageView.setShadowEnable(true);
// or with custom param
circularImageView.setShadowRadius(15);
circularImageView.setShadowColor(Color.RED);
circularImageView.setBackgroundColor(Color.RED);
circularImageView.setShadowGravity(CircularImageView.ShadowGravity.CENTER);

댓글 없음:

댓글 쓰기

JavaScript, Array.some(), Array.every()

 Array.every(callbackfn: (value: T, index: number, array: T[]) => unknow, thisArg?: any): boolean      const   array  = [ 'A' ,  ...