【发布时间】:2015-06-28 14:15:05
【问题描述】:
我想在我的应用底部显示一个页码,例如 3/10,滑动后,数字将是 4/10。 我的布局是用户禁止在它们之间滑动的 webview,我想在底部栏中指示 webview 当前索引,每次滑动后都会更新。 基本布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px">
<android.webkit.WebView
android:layout_width="match_parent"
android:layout_height="413.3dp"
android:id="@+id/tipsWebView"
android:layout_marginBottom="0.0dp" />
//bar position
</LinearLayout>
并显示我使用的不同网络视图:
adaptor.AddFragmentView((i, v, b) =>
{
if(m_swipeCounter < m_links.Length)
{
m_swipeCounter++;
}
else
{
m_swipeCounter= 0;
}
var view = i.Inflate(Resource.Layout.tab, v, false);
var client = new WebClient();
string htmlData = client.DownloadString(m_links[m_swipeCounter]);
htmlData +="<link rel=\"stylesheet\" type=\"text/css\" href=\"cssInject.css\">";
WebView tipsWebView = view.FindViewById<WebView>(Resource.Id.tipsWebView);
tipsWebView.SetWebViewClient(new WebViewClient());
tipsWebView.Settings.JavaScriptEnabled = true;
tipsWebView.LoadDataWithBaseURL("file:///android_asset/", htmlData, "text/html", "", null);
return view;
//create pager, pager adaptor to create the right webview link
});
所以索引将基于m_swipeCounter 变量。
一切顺利。
【问题讨论】:
标签: android webview xamarin android-actionbar indicator