我正在使用Xamarin.Forms开发一个应用程序来列出来自不同来源的新闻.我使用webView打开与新闻相对应的链接.但我希望在将网页加载到Web视图时显示进度,例如Safari App上的进度条.为此,我使用了ProgressBar元素,如下所示:
<StackLayout>
<!-- WebView needs to be given height and width request within layouts to render. -->
<ProgressBar Progress ="" HorizontalOptions="FillAndExpand" x:Name="progress"/>
<WebView x:Name="webView"
HeightRequest="1000"
WidthRequest="1000"
VerticalOptions= "FillAndExpand"
Navigating="webOnNavigating"
Navigated="webOnEndNavigating"/>
</StackLayout>
Run Code Online (Sandbox Code Playgroud)
并在我使用的代码中
void webOnNavigating (object sender, WebNavigatingEventArgs e)
{
progress.IsVisible = true;
}
void webOnEndNavigating (object sender, WebNavigatedEventArgs e)
{
progress.IsVisible = false;
}
Run Code Online (Sandbox Code Playgroud)
但我想展示加载数据的进度,而不仅仅是加载和加载的指示.我希望用户知道数据正在加载.有没有办法实现这一目标.
我开发了一款用于YouTube android API在应用内播放特定视频的应用.那时我已经使用了目标API 19,并且还使用了目标API 19.现在我想改变应用程序切换到Material Design使用目标API 22并使用的设计AppCompat-v7 :22+ library.但YouTubeBaseActivity无法打开,应用程序崩溃.下面我将发布到目前为止我所做的事情.
EventDetail.java
public class EventDetail extends YouTubeBaseActivity implements
YouTubePlayer.OnInitializedListener { .
.
.
protected void onCreate(Bundle savedInstanceState) {
// remove the shadow from action bar
setTheme(R.style.Theme_TranslucentActionBar_ActionBar_NoOverlay);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_event_detail);
// enable back button
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// setting the action bar initially transparent
mActionBarBackgroundDrawable = new ColorDrawable(
Color.parseColor("#ec5c59"));
mActionBarBackgroundDrawable.setAlpha(0);
getSupportActionBar().setBackgroundDrawable(mActionBarBackgroundDrawable);
// binding the scrollview
...
Run Code Online (Sandbox Code Playgroud)
清单文件
<activity
android:name="com.dev.apk.evente.al.EventDetail"
android:icon="@drawable/ikona_projekte"
android:label="@string/title_activity_event_detail"
android:screenOrientation="portrait"
android:theme="@style/Theme.TranslucentActionBar.ActionBar.Overlay" />
Run Code Online (Sandbox Code Playgroud)
Layut文件:
<RelativeLayout
android:id="@+id/video_layout" …Run Code Online (Sandbox Code Playgroud) android android-appcompat android-youtube-api android-5.0-lollipop
好的,这是事情:
/Users/crs/Projects/time.al/Droid: Error XA5209: Unzipping failed. Please download https://dl-ssl.google.com/android/repository/android_m2repository_r22.zip and extract it to the /Users/crs/.local/share/Xamarin/Android.Support.v4/23.0.1.3/content directory. (XA5209) (time.al.Droid)我能做什么,因为我需要将Xamarin.Forms更新到最新版本,但我很长时间都坚持这个.