Я не могу запустить два веб-просмотра одновременно, я пытался поиграть с ним, но мне нужна помощь ... это не так просто, как сказать View2
как в Swift
.
расположение
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffb067"
tools:context=".FeedFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:gravity="center"
android:textColor="@android:color/white"
android:textSize="20sp"
android:textStyle="bold"
android:text="Feed Fragment" />
<WebView
android:id="@+id/livefeed"
android:layout_width="match_parent"
android:layout_height="310dp"
android:layout_marginTop="200dp" />
<WebView
android:id="@+id/livestream"
android:layout_width="match_parent"
android:layout_height="200dp" >
</WebView>
</FrameLayout>
фрагмент
public class FeedFragment extends Fragment {
private WebView livestream;
private WebView livefeed;
public FeedFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_feed, container, false);
}
@Override
public void onViewCreated(View view , Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
livestream = (WebView) view.findViewById(R.id.livestream);
livestream.setWebViewClient(new WebViewClient());
livestream.loadUrl("website1");
livefeed = (WebView) view.findViewById(R.id.livefeed);
livefeed.setWebViewClient(new WebViewClient());
livefeed.loadUrl("website2");
}
}
Один вид - это видеопоток, другой - заметки для потока.