当动态地在片段中膨胀时,NativeAppInstallAdView引用始终为null

时间:2018-03-15 05:38:06

标签: android android-fragments google-admob native-ads

下面是我在<div class="inputFields"> <label for="headline">Headline or Title</label><br> <input type="text" id="headline" placeholder="Enter your title here"><br> <label for="articleContent">Enter your content here</label><br> <textarea id="articleContent" placeholder="Once upon a time....."></textarea> <button id="submitArticleButton">Submit!</button> </div> <div id="newArticle"> <h1 id="userArticleHeader"></h1> <p id="userArticleContent"></p> <button id="editPost">Edit</button> </div>动态膨胀的xml。但是,当我这样做时,

Fragment

NativeAppInstallAdView add = (NativeAppInstallAdView) contentView.findViewById(R.id.adView); 引用在其他视图(如

)中为空
add

工作正常。我无法确切地知道它为什么会发生在这里。任何帮助都会很棒。

ImageView imgLogo = (ImageView) contentView.findViewById(R.id.ivLogo);

0 个答案:

没有答案