Android layout Android-findViewById正在部分工作

Android layout Android-findViewById正在部分工作,android-layout,android-asynctask,findviewbyid,setcontentview,Android Layout,Android Asynctask,Findviewbyid,Setcontentview,我有一个包含两个兄弟视图的xml,如下所示: <TextView android:layout_width="0dp" android:layout_height="wrap_content" android:textAppearance="?android:attr/textAppearanceMedium" android:textSize="12sp" android:textColor="#ffffffff" android:layo

我有一个包含两个兄弟视图的xml,如下所示:

<TextView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:textSize="12sp"
    android:textColor="#ffffffff"
    android:layout_weight="20"
    android:gravity="center_horizontal"
    android:layout_column="0"
    android:layout_columnWeight="45"
    android:layout_rowWeight="10"
    android:id="@+id/type"
    android:text="First\nLow" />

<TextView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:textAppearance="?android:attr/textAppearanceMedium"
    android:text="12:16 AM"
    android:textSize="20sp"
    android:textColor="#ffffffff"
    android:layout_weight="40"
    android:gravity="center_horizontal"
    android:layout_columnWeight="45"
    android:layout_rowWeight="10"
    android:layout_gravity="center_vertical"
    android:id="@+id/time" />
对象
time\u textView
工作正常。问题是
type\u textView
null

两个文本视图位于同一布局中,并且它们都具有相同的父布局(同级)。 这实际上发生在其他10个文本视图上,而其他20个兄弟文本视图工作正常。 我只带了两个兄弟姐妹来直截了当地回答这个问题。

我搜索并尝试了所有相关的findViewById解决方案:

1. Clean and Rebuild. 2. Delete XML and and add it again. 3. Cache Invalidate and Restart. 4. SetContentView(). 5. Fixing all errors in all XML files (I still have tons of silly warnings like must use @dimens and @strings). 6. Make the ID's unique among all XML files. 1.清理和重建。 2.删除XML并再次添加它。 3.缓存失效并重新启动。 4.SetContentView()。 5.修复所有XML文件中的所有错误(我仍然有大量愚蠢的警告,比如必须使用@dimens和@strings)。 6.使ID在所有XML文件中唯一。 如果重要的话,我会在AsyncTask
doInBackground
中完成所有这些。我试着将它移动到
onPostExecute
,但仍然存在相同的问题


谢谢。

您在布局中是否有任何其他视图是使用id
类型调用的
findViewById
?您是否从异步的
doInBackground()
调用
findViewById()
?@Matthew Nope。[在]约翰·P.是的,我是,我也试着在onPostExecute中这样做。 1. Clean and Rebuild. 2. Delete XML and and add it again. 3. Cache Invalidate and Restart. 4. SetContentView(). 5. Fixing all errors in all XML files (I still have tons of silly warnings like must use @dimens and @strings). 6. Make the ID's unique among all XML files.