2013年10月20日日曜日

eclipse でlayoutが表示されなくなる問題

突然、いつのまにか、 eclipse でlayoutが表示されなくなり、以下のメッセージが出る問題が発生しました。

activity_main.xml
>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 style 'spinnerStyle' in current theme
>Failed to find style 'textViewStyle' in current theme
>android.content.res.Resources$NotFoundException
>"?android:attr/listPreferredItemHeight" in attribute "minHeight" is not a valid format.
>Exception details are logged in Window > Show View > Error Log
>The following classes could not be found:
>- TextView (Change to android.widget.TextView, Fix Build Path, Edit XML)

(未解決)

spinnerStyle, textViewStyleを消しても解決しない。

結局、以下の手順で解決した。

・layoutのファイル、activity_main.xml の内容をコピーしておき
layoutのファイルを一度消す。

・念のため「Project」→「Clean」を実行しておく。

・「File」→「New」からlayoutのファイル、activity_main.xmlを新規作成する。
内容をペーストする。


根本の解決ではないが、ディレクトリの中身を比較しても違いがない。
でもこの手順で解決する。疑問。根本解決しない。

まずは、ファイルの作り直しで乗り切る事にする。

○追記
ただしい対処方法はeclipseの再起動でした。
なぜそれが必要になるのかは不明ですが

正しく記載されていれば再起動でなおります。

コードの記載の間違いの可能性を考えながらの場合は
なおしたらeclipse再起度して確認を繰り返せば解決する。

なぜなのかが残りますが、eclipseの対応が必要なのかな。期待します。

0 件のコメント:

コメントを投稿