本文整理汇总了C#中Android.Views.View.SetBackgroundDrawable方法的典型用法代码示例。如果您正苦于以下问题:C# View.SetBackgroundDrawable方法的具体用法?C# View.SetBackgroundDrawable怎么用?C# View.SetBackgroundDrawable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Views.View
的用法示例。
在下文中一共展示了View.SetBackgroundDrawable方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnViewCreated
public override void OnViewCreated (View view, Bundle savedInstanceState)
{
base.OnViewCreated (view, savedInstanceState);
view.SetBackgroundDrawable (AndroidExtensions.DefaultBackground);
SetEmptyText ("You have no favorites yet");
ListView.ItemClick += (sender, e) => stationShower (e.Id);
}
示例2: setBackground
public static void setBackground(View view, Drawable background) {
if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.JellyBean)
{
SDK16.setBackground(view, background);
} else {
view.SetBackgroundDrawable(background);
}
}
示例3: OnCreate
public override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
mView = new View(this.Activity);
GradientDrawable background = (GradientDrawable) Resources.GetDrawable(Resource.Drawable.rounded_rect);
background.SetColor(mColour);
mView.SetBackgroundDrawable(background);
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, Xamarin.ActionbarSherlockBinding.App.ActionBar.LayoutParams.FillParent, mWeight);
lp.SetMargins(marginLeft, marginTop, marginRight, marginBottom);
mView.LayoutParameters = lp;
}
示例4: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
// Create your application here
SetContentView (Resource.Layout.MapViewLayout);
assignmentMapViewLayout = FindViewById<LinearLayout> (Resource.Id.mapViewAssignmentLayout);
assignmentMapViewLayout.Click += (sender, e) => {
var intent = new Intent (this, typeof(SummaryActivity));
var tabActivity = (AssignmentTabActivity)Parent;
tabActivity.MapData = null;
assignmentViewModel.SelectedAssignment = assignmentViewModel.ActiveAssignment;
menuViewModel.MenuIndex = Constants.Navigation.IndexOf ("Map");
StartActivity (intent);
};
mapView = FindViewById<MapView> (Resource.Id.googleMapsView);
mapView.OnCreate (bundle);
mapView.GetMapAsync (this);
//View containing the active assignment
var view = new View (this);
LayoutInflater inflator = (LayoutInflater)GetSystemService (Context.LayoutInflaterService);
view = inflator.Inflate (Resource.Layout.AssignmentItemLayout, null);
assignmentMapViewLayout.AddView (view);
view.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
view.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.active_assignment_selector));
number = view.FindViewById<TextView> (Resource.Id.assignmentItemNumber);
job = view.FindViewById<TextView> (Resource.Id.assignmentJob);
name = view.FindViewById<TextView> (Resource.Id.assignmentName);
phone = view.FindViewById<TextView> (Resource.Id.assignmentPhone);
address = view.FindViewById<TextView> (Resource.Id.assignmentAddress);
buttonLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentButtonLayout);
timerLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentTimerLayout);
activeSpinner = view.FindViewById<Spinner> (Resource.Id.assignmentStatus);
spinnerImage = view.FindViewById<ImageView> (Resource.Id.assignmentStatusImage);
timer = view.FindViewById<ToggleButton> (Resource.Id.assignmentTimer);
timerText = view.FindViewById<TextView> (Resource.Id.assignmentTimerText);
phoneButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentPhoneLayout);
mapButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentAddressLayout);
phoneButton.Click += (sender, e) => {
Extensions.MakePhoneCall (this, phone.Text);
};
mapButton.Click += (sender, e) => {
var intent = new Intent (this, typeof(SummaryActivity));
var tabActivity = (AssignmentTabActivity)Parent;
tabActivity.MapData = null;
assignmentViewModel.SelectedAssignment = assignmentViewModel.ActiveAssignment;
menuViewModel.MenuIndex = 0;
StartActivity (intent);
};
assignmentViewModel.LoadTimerEntryAsync ().ContinueWith (_ => {
RunOnUiThread (() => {
timer.Checked = assignmentViewModel.Recording;
});
});
timer.CheckedChange += (sender, e) => {
if (e.IsChecked != assignmentViewModel.Recording) {
if (assignmentViewModel.Recording)
assignmentViewModel.PauseAsync ();
else
assignmentViewModel.RecordAsync ();
}
};
activeSpinner.ItemSelected += (sender, e) => {
if (assignment == null)
return;
var selected = assignmentViewModel.AvailableStatuses.ElementAtOrDefault (e.Position);
if (selected != assignment.Status) {
switch (selected) {
case AssignmentStatus.Hold:
assignment.Status = selected;
assignmentViewModel.SaveAssignmentAsync (assignment).ContinueWith (_ => {
RunOnUiThread (() => {
SetAssignment (false);
UpdateLocations ();
});
});
break;
case AssignmentStatus.Complete:
var intent = new Intent (this, typeof(SummaryActivity));
menuViewModel.MenuIndex = Constants.Navigation.IndexOf (Constants.Confirmations);
StartActivity (intent);
break;
default:
break;
}
}
};
}
示例5: OnViewCreated
public override void OnViewCreated (View view, Bundle savedInstanceState)
{
base.OnViewCreated (view, savedInstanceState);
view.SetBackgroundDrawable (AndroidExtensions.DefaultBackground);
}
示例6: SetSeparator
/**
* Sets the resource ID of the separator drawable to use between adjacent screens.
*/
public void SetSeparator(int resId) {
if (mSeparatorDrawable != null && resId == 0) {
// remove existing separators
mSeparatorDrawable = null;
int num = ChildCount;
for (int i = num - 2; i > 0; i -= 2) {
RemoveViewAt(i);
}
RequestLayout();
} else if (resId != 0) {
// add or update separators
if (mSeparatorDrawable == null) {
// add
int numsep = ChildCount;
int insertIndex = 1;
mSeparatorDrawable = Resources.GetDrawable(resId);
for (int i = 1; i < numsep; i++) {
View v = new View(Context);
v.SetBackgroundDrawable(mSeparatorDrawable);
LayoutParams lp = new LayoutParams(LayoutParams.WrapContent,LayoutParams.FillParent);
v.LayoutParameters = lp;
AddView(v, insertIndex);
insertIndex += 2;
}
RequestLayout();
} else {
// update
mSeparatorDrawable = Resources.GetDrawable(resId);
int num = ChildCount;
for (int i = num - 2; i > 0; i -= 2) {
GetChildAt(i).SetBackgroundDrawable(mSeparatorDrawable);
}
RequestLayout();
}
}
}
示例7: OnViewCreated
public override void OnViewCreated(View view, Bundle savedInstanceState)
{
base.OnViewCreated(view, savedInstanceState);
view.SetBackgroundDrawable(AndroidExtensions.DefaultBackground);
mapFragment?.GetMapAsync(this);
// Setup info pane
SetSvgImage(pane, Resource.Id.bikeImageView, Resource.Raw.bike);
SetSvgImage(pane, Resource.Id.lockImageView, Resource.Raw.ic_lock);
SetSvgImage(pane, Resource.Id.stationLock, Resource.Raw.station_lock);
SetSvgImage(pane, Resource.Id.bikeNumberImg, Resource.Raw.bike_number);
SetSvgImage(pane, Resource.Id.clockImg, Resource.Raw.clock);
SetSvgImage(pane, Resource.Id.stationNotInstalled, Resource.Raw.not_installed);
starOnDrawable = SvgFactory.GetDrawable(Resources, Resource.Raw.star_on);
starOffDrawable = SvgFactory.GetDrawable(Resources, Resource.Raw.star_off);
var starBtn = pane.FindViewById<ImageButton>(Resource.Id.StarButton);
starBtn.Click += HandleStarButtonChecked;
streetViewFragment?.GetStreetViewPanoramaAsync(this);
}
示例8: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.AssignmentsLayout);
assignmentsListView = FindViewById<ListView> (Resource.Id.assignmentsListView);
assignmentActiveLayout = FindViewById<LinearLayout> (Resource.Id.assignmentSelectedItem);
assignmentActiveLayout.Click += (sender, e) => AssignmentSelected (-1);
assignmentsListView.ItemClick += (sender, e) => AssignmentSelected (e.Position);
//View containing the active assignment
var view = new View (this);
LayoutInflater inflator = (LayoutInflater)GetSystemService (Context.LayoutInflaterService);
view = inflator.Inflate (Resource.Layout.AssignmentItemLayout, null);
assignmentActiveLayout.AddView (view);
view.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
view.SetBackgroundDrawable (Resources.GetDrawable (Resource.Drawable.active_assignment_selector));
number = view.FindViewById<TextView> (Resource.Id.assignmentItemNumber);
job = view.FindViewById<TextView> (Resource.Id.assignmentJob);
name = view.FindViewById<TextView> (Resource.Id.assignmentName);
phone = view.FindViewById<TextView> (Resource.Id.assignmentPhone);
address = view.FindViewById<TextView> (Resource.Id.assignmentAddress);
buttonLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentButtonLayout);
timerLayout = view.FindViewById<LinearLayout> (Resource.Id.assignmentTimerLayout);
activeSpinner = view.FindViewById<Spinner> (Resource.Id.assignmentStatus);
spinnerImage = view.FindViewById<ImageView> (Resource.Id.assignmentStatusImage);
timer = view.FindViewById<ToggleButton> (Resource.Id.assignmentTimer);
timerText = view.FindViewById<TextView> (Resource.Id.assignmentTimerText);
phoneButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentPhoneLayout);
mapButton = view.FindViewById<RelativeLayout> (Resource.Id.assignmentAddressLayout);
timer.CheckedChange += (sender, e) => {
if (e.IsChecked != assignmentViewModel.Recording) {
if (assignmentViewModel.Recording)
assignmentViewModel.PauseAsync ();
else
assignmentViewModel.RecordAsync ();
}
};
activeSpinner.ItemSelected += (sender, e) => {
if (assignment != null) {
var selected = assignmentViewModel.AvailableStatuses.ElementAtOrDefault (e.Position);
if (selected != assignment.Status) {
switch (selected) {
case AssignmentStatus.Hold:
timer.Checked = false;
assignment.Status = selected;
assignmentViewModel.SaveAssignmentAsync (assignment).ContinueWith (_ => RunOnUiThread (ReloadAssignments));
break;
case AssignmentStatus.Complete:
//go to confirmations, this is getting called multiple times.
var intent = new Intent (this, typeof(SummaryActivity));
assignmentViewModel.SelectedAssignment = assignment;
menuViewModel.MenuIndex = Constants.Navigation.IndexOf (Constants.Confirmations);
StartActivity (intent);
break;
default:
break;
}
}
}
};
mapButton.Click += (sender, e) => {
var activity = (AssignmentTabActivity)Parent;
var intent = new Intent (activity, typeof(SummaryActivity));
menuViewModel.MenuIndex = Constants.Navigation.IndexOf ("Map");
assignmentViewModel.SelectedAssignment = assignmentViewModel.ActiveAssignment;
activity.StartActivity (intent);
};
phoneButton.Click += (sender, e) => {
Extensions.MakePhoneCall (this, phone.Text);
};
}
示例9: SetBackgroundCompat
public static void SetBackgroundCompat(View view, Drawable d)
{
if (Build.VERSION.SdkInt < BuildVersionCodes.JellyBean)
{
view.SetBackgroundDrawable(d);
}
else
{
view.Background = d;
}
}