本文整理汇总了C#中WebView.SetBackgroundColor方法的典型用法代码示例。如果您正苦于以下问题:C# WebView.SetBackgroundColor方法的具体用法?C# WebView.SetBackgroundColor怎么用?C# WebView.SetBackgroundColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebView
的用法示例。
在下文中一共展示了WebView.SetBackgroundColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
WebView view = new WebView(this);
string html;
using (var sr = new StreamReader(Assets.Open("licensure.html")))
{
html = sr.ReadToEnd();
}
view.LoadData(html, "text/html", "UTF-8");
view.SetBackgroundColor(Color.Transparent);
SetContentView(view);
}
示例2: PrepareViews
//.........这里部分代码省略.........
if (packItem != null)
{
RunOnUiThread(delegate
{
using (ImageView preview = new ImageView (context))
{
preview.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(newSizes [0], context), (int)ImageHelper.convertDpToPixel(newSizes [1], context));
preview.SetScaleType(ImageView.ScaleType.FitXy);
preview.SetImageResource(Resource.Drawable.audiofile);
linView.AddView(preview);
byte[] audio = packItem.ContentPackData;
System.IO.File.WriteAllBytes(path, audio);
AudioPlayer csfx = new AudioPlayer(context);
t.Interval = csfx.findDuration(path) + 1000;
csfx.playFromFile(path);
this.stepViews [eachMessageStep.StepNumber] = preview;
}
});
}
break;
case MessageStep.StepTypes.Emoticon:
if (packItem != null)
{
//RunOnUiThread (delegate {
t.Interval = 5000;
string base64String = System.Convert.ToBase64String(packItem.ContentPackData, 0, packItem.ContentPackData.Length);
using (WebView wv = new WebView (context))
{
string url = "<img src=\"data:image/gif;base64," + base64String + "\" width=\"" + ((int)newSizes [0]).ToString() + "\" height=\"" + ((int)newSizes [1]).ToString() + "\" />";
wv.LoadDataWithBaseURL(null, url, "text/html", "UTF-8", null);
wv.VerticalScrollBarEnabled = false;
wv.HorizontalScrollBarEnabled = false;
wv.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(200f, context), (int)ImageHelper.convertDpToPixel(200f, context));
wv.SetBackgroundColor(Color.Transparent);
RunOnUiThread(() => linView.AddView(wv));
}
//});
}
break;
case MessageStep.StepTypes.Voice:
if (MessagePlaybackUtil.voiceRecordings != null)
{
RunOnUiThread(delegate
{
using (ImageView preview = new ImageView (context))
{
preview.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(newSizes [0], context), (int)ImageHelper.convertDpToPixel(newSizes [1], context));
preview.SetScaleType(ImageView.ScaleType.FitXy);
preview.SetImageResource(Resource.Drawable.microphone);
linView.AddView(preview);
this.stepViews [eachMessageStep.StepNumber] = preview;
}
//byte[] audio = getLocalVoiceRecording (MessagePlaybackUtil.voiceRecordings [eachMessageStep.StepNumber]);
AudioPlayer voice = new AudioPlayer(context);
#if DEBUG
System.Diagnostics.Debug.WriteLine("audio file filename = {0}, stepNumber = {1}", MessagePlaybackUtil.voiceRecordings [eachMessageStep.StepNumber], eachMessageStep.StepNumber);
#endif
t.Interval = voice.findDuration(MessagePlaybackUtil.voiceRecordings [eachMessageStep.StepNumber]) + 1000;
string audioPath = MessagePlaybackUtil.voiceRecordings [eachMessageStep.StepNumber];
if (!File.Exists(audioPath))
{
#if DEBUG
System.Diagnostics.Debug.WriteLine("audio file doesn't exist for playback");
#endif
} else
voice.playFromFile(audioPath);
示例3: displayNewIcon
private void displayNewIcon()
{
float[] newSizes = new float[2];
newSizes [0] = newSizes [1] = 100f;
if (option == 2 || option == 5)
ib.Visibility = pb.Visibility = ViewStates.Visible;
if (option == 6)
{
string base64String = System.Convert.ToBase64String(ContentPackItemsUtil.content, 0, ContentPackItemsUtil.content.Length);
RunOnUiThread(delegate
{
if (wowZapp.LaffOutOut.Singleton.resizeFonts)
{
newSizes [0] *= wowZapp.LaffOutOut.Singleton.bigger;
newSizes [1] = newSizes [0];
}
WebView wv = new WebView(context);
string url = "<img src=\"data:image/gif;base64," + base64String + "\" width=\"" + ((int)newSizes [0]).ToString() + "\" height=\"" + ((int)newSizes [1]).ToString() + "\" />";
wv.LoadDataWithBaseURL(null, url, "text/html", "UTF-8", null);
wv.VerticalScrollBarEnabled = false;
wv.HorizontalScrollBarEnabled = false;
wv.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(newSizes [0], context), (int)ImageHelper.convertDpToPixel(newSizes [1], context));
wv.SetBackgroundColor(Android.Graphics.Color.Transparent);
webImages = wv;
layout.AddView(wv);
btnAdd.Visibility = ViewStates.Visible;
btnSend.Visibility = ViewStates.Visible;
});
} else
{
if (option == 2 || option == 5)
{
pb.Visibility = ib.Visibility = ViewStates.Visible;
ib.Click += delegate
{
playAudio(pb);
};
}
RunOnUiThread(delegate
{
MemoryStream stream = new MemoryStream(ContentPackItemsUtil.content);
Android.Graphics.Drawables.Drawable draw = Android.Graphics.Drawables.Drawable.CreateFromStream(stream, "Profile");
ImageView preview = new ImageView(context);
preview.LayoutParameters = new ViewGroup.LayoutParams((int)ImageHelper.convertDpToPixel(newSizes [0], context), (int)ImageHelper.convertDpToPixel(newSizes [1], context));
preview.SetScaleType(ImageView.ScaleType.FitXy);
preview.SetBackgroundDrawable(draw);
images = preview;
layout.AddView(preview);
btnAdd.Visibility = ViewStates.Visible;
btnSend.Visibility = ViewStates.Visible;
});
}
}
示例4: PreLoadInjectHeader
/**
* Prepare the webview, set Invisible and transparent background
* Must call injectHeader next
*/
public static void PreLoadInjectHeader(WebView mWebView) {
mWebView.SetBackgroundColor(Color.Transparent);
mWebView.Visibility = ViewStates.Invisible;
}
示例5: ShowChangeLog
public static void ShowChangeLog(Context ctx, Action onDismiss)
{
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(ctx, Android.Resource.Style.ThemeHoloLightDialog));
builder.SetTitle(ctx.GetString(Resource.String.ChangeLog_title));
List<string> changeLog = new List<string>{
ctx.GetString(Resource.String.ChangeLog_0_9_8b),
ctx.GetString(Resource.String.ChangeLog_0_9_8),
#if !NoNet
//0.9.7b fixes were already included in 0.9.7 offline
ctx.GetString(Resource.String.ChangeLog_0_9_7b),
#endif
ctx.GetString(Resource.String.ChangeLog_0_9_7),
ctx.GetString(Resource.String.ChangeLog_0_9_6),
ctx.GetString(Resource.String.ChangeLog_0_9_5),
ctx.GetString(Resource.String.ChangeLog_0_9_4),
ctx.GetString(Resource.String.ChangeLog_0_9_3_r5),
ctx.GetString(Resource.String.ChangeLog_0_9_3),
ctx.GetString(Resource.String.ChangeLog_0_9_2),
ctx.GetString(Resource.String.ChangeLog_0_9_1),
ctx.GetString(Resource.String.ChangeLog_0_9),
ctx.GetString(Resource.String.ChangeLog_0_8_6),
ctx.GetString(Resource.String.ChangeLog_0_8_5),
ctx.GetString(Resource.String.ChangeLog_0_8_4),
ctx.GetString(Resource.String.ChangeLog_0_8_3),
ctx.GetString(Resource.String.ChangeLog_0_8_2),
ctx.GetString(Resource.String.ChangeLog_0_8_1),
ctx.GetString(Resource.String.ChangeLog_0_8),
ctx.GetString(Resource.String.ChangeLog_0_7),
ctx.GetString(Resource.String.ChangeLog)
};
String version;
try {
PackageInfo packageInfo = ctx.PackageManager.GetPackageInfo(ctx.PackageName, 0);
version = packageInfo.VersionName;
} catch (PackageManager.NameNotFoundException) {
version = "";
}
string warning = "";
if (version.Contains("pre"))
{
warning = ctx.GetString(Resource.String.PreviewWarning);
}
builder.SetPositiveButton(Android.Resource.String.Ok, (dlgSender, dlgEvt) => {((AlertDialog)dlgSender).Dismiss(); });
builder.SetCancelable(false);
WebView wv = new WebView(ctx);
wv.SetBackgroundColor(Color.White);
wv.LoadDataWithBaseURL(null, GetLog(changeLog, warning, ctx), "text/html", "UTF-8", null);
//builder.SetMessage("");
builder.SetView(wv);
Dialog dialog = builder.Create();
dialog.DismissEvent += (sender, e) =>
{
onDismiss();
};
dialog.Show();
/*TextView message = (TextView)dialog.FindViewById(Android.Resource.Id.Message);
message.TextFormatted = Html.FromHtml(ConcatChangeLog(ctx, changeLog.ToArray()));
message.AutoLinkMask=MatchOptions.WebUrls;*/
}