맞춤 이미지 제목과 함께 TabActivity를 사용하고 있습니다. 전화를 걸 때FindViewById는 Android에서 맞춤 제목을 사용할 때 null을 반환합니다.
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.my_custom_title);
if (resId > 0)
{
ImageView im = (ImageView) findViewById(R.id.title_bar);
im.setImageResource(resId);
}
'im'은 null입니다. 다른 질문에 따라 setContentView를 호출하지 않으면이 문제가 발생할 수 있지만 레이아웃 파일을 사용하지 않는다는 것을 알았습니다. 내가 빠진 것이 있습니까?
이
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:orientation="vertical">
<ImageView android:src="@drawable/launch"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:id="@+id/title_bar"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" />
</LinearLayout>
감사합니다,
Rajath이
당신이 당신의 레이아웃 파일을 게시 할 수 사용 my_custom_title.xml입니까? – xil3
레이아웃 파일 – rajath