카톡의 친추목록처럼 상단바 타이틀에 색깔을 넣고싶은데요.
조회수 1527회
1 답변
-
액션바에 커스텀 레이아웃을 등록하시면 될것 같습니다. 저는 이런식으로 해봤습니다.
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);
댓글 입력