style.xml의 커스텀 textView 만들기


<style name="CustomTextView"  parent="@android:style/Widget.TextView">

    <item name="android:layout_width">match_parent</item>

    <item name="android:layout_height">wrap_content</item>

    <item name="android:layout_marginLeft">5dp</item>

    <item name="android:layout_marginRight">10dp</item>

    <item name="android:layout_marginBottom">15dp</item>

    <item name="android:paddingRight">3dp</item>

    <item name="android:paddingLeft">8dp</item>

    <item name="android:textColor">@color/white</item>

    <item name="android:background">@color/custom_main</item>

</style>


위 코드에 원하는 설정 값을 설정한 후


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

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

    android:orientation="vertical" android:layout_width="match_parent"

    android:layout_height="match_parent">


    <TextView

        style="@style/CustomTextView"


        />


    <TextView

        style="@style/CustomTextView"

        />


    <TextView

        style="@style/CustomTextView"


        />

    .

    .

    .



</LinearLayout>



출처: http://gun0912.tistory.com/37 [박상권의 삽질블로그]

'android' 카테고리의 다른 글

투명 액티비티 만들기  (0) 2017.10.27
EditText Style 옵션  (0) 2017.10.11
actionbar 공통으로 사용하기  (0) 2017.10.10
화면 가로, 세로 고정  (0) 2017.10.10
안드로이드 파일경로, 파일명, uri 아이디 찾기  (0) 2017.06.02

+ Recent posts