クラスに文字列の配列がありViewSwitcher
、レイアウトに a があります。
<ViewSwitcher
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/text_view_switcher">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/text"/>
<WebView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/text_webview">
</WebView>
ボタンは 2 つPrevious
ありNext
、ナビゲーション用です。ユーザーが をタップするとNext
、TextView と WebView のテキストを文字列配列の次の要素に設定します。
問題
私は次のことを達成したい:
if(string[index].contains("img src"))
show the Webview;
else
show the textview;
どうすればいいですか?ViewSwitcher.showNext
適切に仕事をしていません。ID を使用して切り替えるビューを関連付ける方法はありますか?