2013-10-23 38 views
0

在我的代碼dialog2.setTitle(「FeedBack」);以白色顯示如何更改標題更改顏色? bcoz我的佈局背景是白色的,所以不能看到幫助我如何更改對話框標題顏色變化?如何將對話框的標題顏色從白色更改爲任何其他顏色

public Dialog dialog2; 

      ImageView b = (ImageView) findViewById(R.id.button1); 

      b.setOnClickListener(new OnClickListener() { 
    @Override 
    public void onClick(View v) { 
    dialog2 = new Dialog(context); 
    View vLoad = LayoutInflater.from(fifthscreen.this).inflate(R.layout.timer, null); 

    dialog2.setContentView(vLoad); 



    dialog2.setTitle("FeedBack"); 



    dialog2.setCancelable(false); 



    dialog2.show(); 
    } 
    }); 

    } 


     ////////////timer.xml/////////// 


       <?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="#ffffff" 

android:id="@+id/layouttimer"> 


     <TextView 
    android:id="@+id/text" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:paddingLeft="5dp" 
    android:paddingRight="5dp" 
    android:textSize="15dp" 
    android:textColor="#000000" ></TextView> 




<Button 
    android:id="@+id/FeedbackYummiSlice" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_horizontal" 
    android:text=" YumiiSlice" > 

</Button> 


<Button 
    android:id="@+id/FeedbackThisdish" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_horizontal" 
    android:text=" Feedback This dish " > 
</Button> 

<Button 
    android:id="@+id/nothanks" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_horizontal" 
    android:text="   No,Thanks   " > 

</Button> 


     </LinearLayout> 
+0

請參考以下帖子http://stackoverflow.com/questions/2482971/how-can-i-change-the-color-of-titlebar-in-jframe – VijayM

+1

你給了什麼鏈接?不理解 – user2867267

回答

0

方法setCustomTitle(View customTitleView)允許您這樣做。您需要創建一個佈局來設置它,並在該佈局中簡單地將TextView設置爲您想要的樣式。

LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); 
View customTitleView = inflater.inflate(R.layout.custom_title_view, null); 

AlertDialog.Builder builder = new AlertDialog.Builder(context) 
.setCustomTitle(customTitleView); 

欲瞭解更多信息請參閱This Answer

+0

我已經創建一個視圖檢查這一行視圖vLoad = LayoutInflater.from(fifthscreen.this).inflate(R.layout.timer,null);並在內容視圖中加載 – user2867267

+0

@ user2867267爲標題(TextView)創建視圖並使用setCustomTitle對其進行設置。 –

+0

但問題是沒有使用Alert dailog im justing簡單的對話框檢查我的代碼 – user2867267

相關問題