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

공통으로 사용할 toolbar layout을 만든 후

해당 레이아웃에 inflater할 영역을 설정하고


아래코드로 구현해준다


LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

RelativeLayout actionBarLayout = (RelativeLayout) findViewById(R.id.actionBar);

inflater.inflate(R.layout.actionbar, actionBarLayout, true);

'android' 카테고리의 다른 글

EditText Style 옵션  (0) 2017.10.11
커스텀 텍스트 뷰  (0) 2017.10.10
화면 가로, 세로 고정  (0) 2017.10.10
안드로이드 파일경로, 파일명, uri 아이디 찾기  (0) 2017.06.02
AsyncTask httpConnection  (0) 2016.12.27

AndroidManifest.xml의 해당 액티비티에 추가해준다


세로 고정

android:screenOrientation="portrait"


가로 고정

android:screenOrientation="landscape"



+ Recent posts