Shape를 만든 후

<?xml version="1.0" encoding="UTF-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android"

       android:shape="rectangle">

    <solid android:color="@color/buttonColor"/>

    <stroke

        android:width="1dp"

        android:color="@color/transparent" />

    <corners

        android:bottomRightRadius="5dp"

        android:bottomLeftRadius="5dp"

        android:topLeftRadius="5dp"

        android:topRightRadius="5dp"/>

    <padding

        android:left="1dp"

        android:top="1dp"

        android:right="1dp"

        android:bottom="1dp" />

</shape>

 

적용하고자하는 레이아웃에 백그라운드로 적용

<Button

    android:id="@+id/btn"

    app:backgroundTint="@null"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:layout_marginTop="5dp"

    android:background="@drawable/your_shape"

    android:gravity="center"

    android:text="@string/login"

    android:textColor="@color/white"

    android:textSize="14sp"

    android:textStyle="bold"/>

 

적용한 액티비티에 아래 코드로 Shape에 색상을 변경하면됨

GradientDrawable bgShape = (GradientDrawable) btn.getBackground();

bgShape.setColor(Color.BLACK);

 

Drawable bgShape = DrawableCompat.wrap(btn.getbackground()).mutate();

DrawableCompat.setTint(bgShape, ContextCompat.getColor(mContext, R.color.yourColor));

 

 

'android' 카테고리의 다른 글

appbarlayout 스크롤 Enable, disable  (0) 2017.11.22
recyclerview scroll 정보 가져오기  (0) 2017.11.22
문자, 전화 intent  (0) 2017.11.13
리스트뷰, 스크롤뷰 리플 이펙트 제거  (0) 2017.11.07
이미지뷰 라운드 처리  (0) 2017.10.30

문자 화면

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData( Uri.parse("sms:" + "01000000000"));
startActivity(intent);


전화 걸기

Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:" + userPhone));

startActivity(intent);


1. xml에 적용

<android.support.v7.widget.RecyclerView

    android:id="@+id/recyclerView"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:overScrollMode="never" />


2. style.xml에 적용시 추가

<item name="android:overScrollMode">never</item>


3. 코드에 적용시

ListView.setOverscrollHeader(drawable); // 상단

ListView.setOverscrollFooter(drawable);  // 하단



'android' 카테고리의 다른 글

shape 백그라운드 컬러 다이나믹하게 적용하기  (0) 2017.11.14
문자, 전화 intent  (0) 2017.11.13
이미지뷰 라운드 처리  (0) 2017.10.30
투명 액티비티 만들기  (0) 2017.10.27
EditText Style 옵션  (0) 2017.10.11

+ Recent posts