안드로이드 기본 창 제목 스타일을 사용하여 나만의 비슷하게 만들 수있는 방법 TextView
?Android에서 맞춤 제목보기 만들기
저는 많은 추측을했으며 텍스트 그림자 (및 일부 여백/여백 등)를 제외하고는 기본 제목 표시 줄에있는 모든 것을 TextView로 만들었습니다. 여기
내가 무엇을 시도했다 근본적이다 :MainUI.xml
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar);
}
title_bar.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTitle"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:textAppearance="@android:style/TextAppearance.WindowTitle"
android:background="@android:drawable/title_bar"
android:text="This is my new title" />
편집 :
은 내가 찾은 몇 가지 흥미로운 관련 기사 makemachine 및 anddev.
나는 그것을 좋아하지 않지만, 구현에서 일부 속성을 복사했습니다 style.xml.
이 정적 인 방법으로 속성을 복사하지 않도록 할 수있는 방법이 있습니까?
다음은 거의 완벽하게 렌더링되었지만 차이점은 원래 TextView
은 원본이 제목 그림자의 처음 2-3 픽셀을 "잘라내"했다는 것입니다. 기본은 당신이 사용자 정의 제목 표시 줄을 포장하지 않으려는 일부 패딩 등을 포함하기 때문에, 투명한 색으로 windowTitleBackgroundStyle :
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTitle"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:gravity="center_vertical"
android:shadowColor="#BB000000"
android:shadowRadius="2.75"
android:singleLine="true"
android:textAppearance="@android:style/TextAppearance.WindowTitle"
android:background="@android:drawable/title_bar"
android:text="This is my new title" />
은 기본 안드로이드를 무시하는 것도 중요합니다.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomTheme" parent="android:Theme">
<item name="android:windowTitleBackgroundStyle">@android:color/transparent</item>
</style>
</resources>
이 나를 위해 일한이 시도 당신의 AndroidManifest.xml
나는 당신이하려는 것을 얻지 못합니다. Android에서 만든 기본 제목 표시 줄을 복사 하시겠습니까? – Macarse
예, 수정할 수있는 한. 제목 표시 줄을 진행 막대로 사용할 수도 있습니다. – Steinbitglis
도움이 될지 모르겠지만 [RomManager] (https://market.android.com/details?id=com.koushikdutta.rommanager&hl= 당신이 ROM을 다운로드하려고 할 때 제목 표시 줄이로드 될 때 왼쪽에서 오른쪽으로 회색으로 채 웁니다. 계층 구조 뷰어를 실행하는 동안 실행하면 진행률 표시 줄과 진행 원이 표시됩니다. –