您好,每位Android极客,我都使用LayoutInflater来吸引我的Android ActionBar。

但我发现差异LayoutInflater会导致生成差异SearchView图标

这是我的区别LayoutInflater和捕获图像

LayoutInflater mInflater1 =(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//You can change mInflater1 =LayoutInflater.from(this); is a same result

LayoutInflater mInflater2 =LayoutInflater.from(getApplicationContext());






我的问题是,为什么LayoutInflater差异会导致SearchView Icon差异?

最佳答案

很好的是,上下文决定了从哪里创建主题。我想您的操作系统和应用具有不同的主题
在此处阅读更多信息http://developer.android.com/reference/android/view/LayoutInflater.html

The Context in which this LayoutInflater will create its Views; most importantly, this supplies the theme from which the default values for their attributes are retrieved.

关于java - 为什么差异LayoutInflater会导致差异SearchView图标,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26281517/

10-13 03:20