2013-10-23 39 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

相关问题