카톡의 친추목록처럼 상단바 타이틀에 색깔을 넣고싶은데요.

조회수 1527회

1 이 사진 보시면 상단바에 친구 4,129하고 오른쪽에 버튼도 있잖아요. 근데 이렇게 친구랑 4,129랑 글씨 색을 다르게 주고 싶은데 어떻게 할 수 있을까요?

1 답변

  • 좋아요

    0

    싫어요
    채택 취소하기

    액션바에 커스텀 레이아웃을 등록하시면 될것 같습니다. 저는 이런식으로 해봤습니다.

    custom_layout.xml

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    
        <TextView
            android:layout_centerVertical="true"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Invite"
            android:textSize="25sp"/>
        <TextView
            android:layout_centerVertical="true"
            android:id="@+id/invite"
            android:layout_marginLeft="62dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="0"
            android:textSize="22sp"
            android:textColor="#000000"/>
    </RelativeLayout>
    
             ActionBar mActionBar = getActionBar();
            mActionBar.setDisplayShowHomeEnabled(false);
            mActionBar.setDisplayShowTitleEnabled(false);
            LayoutInflater mInflater = LayoutInflater.from(this);
    
            View mCustomView = mInflater.inflate(R.layout.custom_layout, null);
    
            mActionBar.setCustomView(mCustomView);
            mActionBar.setDisplayShowCustomEnabled(true);
    

답변을 하려면 로그인이 필요합니다.

프로그래머스 커뮤니티는 개발자들을 위한 Q&A 서비스입니다. 로그인해야 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)