1)SwipyRefreshLayout
レポ
2)デバッグ&リリースaar
さん
3)あなたのXamarin.Android
結合プロジェクトにリリースaar
を使用を生成するためにAndroidのメーカーでプロジェクトをビルドを複製
./lib/build/outputs/aar/lib-release.aar
5)BindingプロジェクトをXamarin.Android
への参照として追加しますアプリ。
4)あなたのC#のアプリに
注意をSwipy Javaのテストアプリのリソースを追加します。これは、手動でテストアプリケーションのためにそれらを再作成する必要がスキップするだけのショートカットです。
5)例C#Swipyコード:
[Activity(Label = "Swipy", MainLauncher = true, Icon = "@mipmap/icon")]
public class MainActivity : Activity
{
string[] items;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.Main);
Button buttonTop = FindViewById<Button>(Resource.Id.button_top);
buttonTop.Click += onClick;
Button buttonBottom = FindViewById<Button>(Resource.Id.button_bottom);
buttonBottom.Click += onClick;
Button buttonRefresh = FindViewById<Button>(Resource.Id.button_refresh);
buttonRefresh.Click += onClick;
Button buttonBoth = FindViewById<Button>(Resource.Id.button_both);
buttonBoth.Click += onClick;
items = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", };
var ListAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, items);
ListView listview = FindViewById<ListView>(Resource.Id.listview);
listview.Adapter = ListAdapter;
SwipyRefreshLayout swipyrefreshlayout = FindViewById<SwipyRefreshLayout>(Resource.Id.swipyrefreshlayout);
swipyrefreshlayout.Refresh += async (object sender, SwipyRefreshLayout.RefreshEventArgs e) =>
{
Log.Debug("MainActivity", "Refresh triggered at " + (e.Direction == SwipyRefreshLayoutDirection.Top ? "top" : "bottom"));
swipyrefreshlayout.Refreshing = true;
await Task.Delay(2000); // simulate some data refresh
RunOnUiThread(() =>
{
swipyrefreshlayout.Refreshing = false;
});
};
}
async void onClick(object sender, EventArgs e)
{
SwipyRefreshLayout swipyrefreshlayout = FindViewById<SwipyRefreshLayout>(Resource.Id.swipyrefreshlayout);
var v = (View)sender;
switch (v.Id)
{
case Resource.Id.button_top:
swipyrefreshlayout.Direction = SwipyRefreshLayoutDirection.Top;
break;
case Resource.Id.button_bottom:
swipyrefreshlayout.Direction = SwipyRefreshLayoutDirection.Bottom;
break;
case Resource.Id.button_both:
swipyrefreshlayout.Direction = SwipyRefreshLayoutDirection.Both;
break;
case Resource.Id.button_refresh:
swipyrefreshlayout.Refreshing = true;
await Task.Delay(2000); // simulate some data refresh
RunOnUiThread(() =>
{
swipyrefreshlayout.Refreshing = false;
});
break;
}
}
}

ありがとう、それはうまくいきました。 – Erli