Android开发-Missing styles 解决方案-AndroidStudio

时间:2021-10-27 01:07:05

xml切换主题出现Missing styles,最后没能找到直接的解决方案。

例如,下拉选择“Light.NoTitleBar”,就会出现:

  Rendering Problems Missing styles. Is the correct theme chosen for this layout?  Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.   Failed to find '?attr/textEditSuggestionItemLayout' in current theme. (33 similar errors not shown)  Tip: Try to refresh the layout.




在java里,尝试使用:

    @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
}
运行到手机里也没有得到正确的效果。





最后,尝试了一下直接在manifests.xml里进行设置:

        <activity android:name=".MainActivity"
android:theme="@style/Theme.AppCompat.Light.NoActionBar">

效果没有问题。暂时这样解决。