친구, 내가 각 활동에 지정 제목 표시 줄을 표시하는 코드안드로이드에서 TextView Value를 동적으로 설정하는 방법?
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myTitle"
android:text="This is my new title"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/titletextcolor"
android:layout_marginLeft="25px"
android:paddingTop="3px"
/>
와 자바 코드를 다음 titlebar.xml 파일을 사용하여 사용자 정의 제목 표시 줄을 만들었습니다
.
@Override
public void onCreate(Bundle savedInstanceState)
{
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.mytitle);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
이제 각 활동에서 동적으로 textview 값을 설정하고 싶습니다. 어떻게하면 하나의 가이드로이를 수행 할 수 있습니까?
여기에서 findviewbyid를 사용하면 주 레이아웃에 mytitle과 같은 이름이있는 텍스트 상자가 없으므로이 텍스트 뷰에 대한 참조를 가져 오지 못합니다.
어떤 도움
은 appriciated 될 것이다.
내가 HTTP를 따라 자습서 : //stackoverflow.com/questions/2251714/set-title-background-color – UMAR