本文整理汇总了C#中LinearLayout类的典型用法代码示例。如果您正苦于以下问题:C# LinearLayout类的具体用法?C# LinearLayout怎么用?C# LinearLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LinearLayout类属于命名空间,在下文中一共展示了LinearLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnElementChanged
protected override void OnElementChanged(ElementChangedEventArgs<Page> e) {
base.OnElementChanged(e);
myAMapPage = e.NewElement as TencentMapPage;
layout1 = new LinearLayout(this.Context);
this.AddView(layout1);
mapView = new MapView(this.Context) {
LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)
};
LatLng SHANGHAI = new LatLng( 31.238068, 121.501654);
mapView.Map.SetCenter(SHANGHAI);
var pins = myAMapPage.Pins;
Drawable d = Resources.GetDrawable(Resource.Drawable.red_location);
Bitmap bitmap = ((BitmapDrawable)d).Bitmap;
LatLng latLng1;
foreach (UserTaskEntInfo pin in pins) {
latLng1 = new LatLng(pin.Longitude ?? 31.238068, pin.Latitude ?? 121.501654);
var markOption = new MarkerOptions();
markOption.InvokeIcon(new BitmapDescriptor(bitmap));
markOption.InvokeTitle(pin.Name);
markOption.InvokePosition(latLng1);
var fix = mapView.Map.AddMarker(markOption);
fix.ShowInfoWindow();
}
mapView.Map.SetZoom(15);
mapView.OnCreate(bundle);
layout1.AddView(mapView);
}
示例2: OnCreateView
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var view = inflater.Inflate (Resource.Layout.FeedbackFragment, container, false);
feedbackPositiveButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackPositiveButton);
feedbackNeutralButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackNeutralButton);
feedbackNegativeButton = view.FindViewById<ImageButton> (Resource.Id.FeedbackNegativeButton);
feedbackPositiveButton.Click += (sender, e) => SetRating (ratingPositive);
feedbackNeutralButton.Click += (sender, e) => SetRating (ratingNeutral);
feedbackNegativeButton.Click += (sender, e) => SetRating (ratingNegative);
feedbackMessageEditText = view.FindViewById<EditText> (Resource.Id.FeedbackMessageText).SetFont (Font.Roboto);
feedbackMessageEditText.AfterTextChanged += OnEdit;
submitFeedbackButton = view.FindViewById<Button> (Resource.Id.SendFeedbackButton).SetFont (Font.Roboto);
submitFeedbackButton.Click += OnSendClick;
feedbackContainer = view.FindViewById<LinearLayout> (Resource.Id.FeedbackContainer);
disclaimerContainer = view.FindViewById<LinearLayout> (Resource.Id.FeedbackDisclaimer);
noUserRegisterButton = view.FindViewById<Button> (Resource.Id.FeedbackRegisterButton);
bool offline = ServiceContainer.Resolve<AuthManager> ().OfflineMode;
disclaimerContainer.Visibility = offline ? ViewStates.Visible : ViewStates.Gone;
feedbackContainer.Visibility = offline ? ViewStates.Gone : ViewStates.Visible;
noUserRegisterButton.Click += OpenRegisterScreen;
SetRating (userRating);
return view;
}
示例3: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var layout = new LinearLayout(this) {
Orientation = Orientation.Vertical
};
this.AddContentView(layout, new ViewGroup.LayoutParams(-1, -1));
this.T1 = new TextView(this);
this.T2 = new TextView(this) {
Text = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")
};
layout.AddView(this.T1);
layout.AddView(this.T2);
var btn = new Button(this) {
Text = "Search"
};
btn.Click += Btn_Click;
layout.AddView(btn);
this.HandleIntent(this.Intent);
}
示例4: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
RequestWindowFeature(WindowFeatures.NoTitle);
SetContentView(Resource.Layout.passcode_main);
_listener = new MessageListener(ACTION_SHAKE, ACTION_DISMISS);
_listener.MessageReceived += HandleMessageReceived;
_numbersEntered = 0;
InitButtons();
_selectedLayout = FindViewById<LinearLayout>(Resource.Id.passcode_toplayout);
if(Intent != null)
{
bool showCancel = Intent.GetBooleanExtra(EXTRA_SHOW_CANCEL, false);
_cancelButton.Visibility = showCancel ? ViewStates.Visible : ViewStates.Invisible;
_passcodeLength = Intent.GetIntExtra(EXTRA_LENGTH, 4);
_animationIn = Intent.GetIntExtra(EXTRA_IN_ANIMATION, 0);
_animationOut = Intent.GetIntExtra(EXTRA_OUT_ANIMATION, 0);
}
HideUnusedCircles();
_passcodeEntered = new int[_passcodeLength];
_shakeAnimation = AnimationUtils.LoadAnimation(this, Resource.Animation.passcode_shake);
}
示例5: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
ViewGroup rootView = (ViewGroup)inflater.Inflate(Resource.Layout.fragment_calendar_events_read, container, false);
settingsLayout = (LinearLayout)rootView.FindViewById(Resource.Id.go_settings_layout);
readEventsLayout = (LinearLayout)rootView.FindViewById(Resource.Id.read_events_layout);
RadCalendarView calendarView = new RadCalendarView(Activity);
adapter = new EventReadAdapter(calendarView);
calendarView.EventAdapter = adapter;
Button settingsButton = (Button)rootView.FindViewById(Resource.Id.go_settings_button);
settingsButton.Click += (object sender, EventArgs e) => {
GoToSettings();
};
Button readEventsButton = (Button)rootView.FindViewById(Resource.Id.read_events_button);
readEventsButton.Click += (object sender, EventArgs e) => {
TryReadEvents();
};
InitLayoutVisibility();
rootView.AddView(calendarView);
return rootView;
}
示例6: OnCreateView
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
var view = inflater.Inflate (Resource.Layout.ProjectListFragment, container, false);
recyclerView = view.FindViewById<RecyclerView> (Resource.Id.ProjectListRecyclerView);
recyclerView.SetLayoutManager (new LinearLayoutManager (Activity));
recyclerView.AddItemDecoration (new ShadowItemDecoration (Activity));
recyclerView.AddItemDecoration (new DividerItemDecoration (Activity, DividerItemDecoration.VerticalList));
emptyStateLayout = view.FindViewById<LinearLayout> (Resource.Id.ProjectListEmptyState);
searchEmptyState = view.FindViewById<LinearLayout> (Resource.Id.ProjectListSearchEmptyState);
tabLayout = view.FindViewById<TabLayout> (Resource.Id.WorkspaceTabLayout);
newProjectFab = view.FindViewById<AddProjectFab> (Resource.Id.AddNewProjectFAB);
toolBar = view.FindViewById<Toolbar> (Resource.Id.ProjectListToolbar);
var activity = (Activity)Activity;
activity.SetSupportActionBar (toolBar);
activity.SupportActionBar.SetDisplayHomeAsUpEnabled (true);
activity.SupportActionBar.SetTitle (Resource.String.ChooseTimeEntryProjectDialogTitle);
HasOptionsMenu = true;
newProjectFab.Click += OnNewProjectFabClick;
tabLayout.SetOnTabSelectedListener (this);
return view;
}
示例7: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
LinearLayout rootLayout = new LinearLayout(this) {
Orientation = Orientation.Vertical
};
// TODO: Demo2 - Step 2 - Start the service
// Button startButton = new Button(this) {
// Text = "Start the Service",
// LayoutParameters = new LinearLayout.LayoutParams(
// ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent),
// };
// rootLayout.AddView(startButton);
//
// startButton.Click += delegate {
// StartService(new Intent(this, typeof(TheService)));
// };
// TODO: Demo2 - Step 4a - Request the service stop
// Button stopButton = new Button(this) {
// Text = "Stop the Service",
// LayoutParameters = new LinearLayout.LayoutParams(
// ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent),
// };
// rootLayout.AddView(stopButton);
//
// stopButton.Click += delegate {
// StopService(new Intent(this, typeof(TheService)));
// };
SetContentView(rootLayout);
}
示例8: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
base.OnCreateView(inflater, container, savedInstanceState);
var view = inflater.Inflate(Resource.Layout.fragment_profile, null);
ratingCircle = view.FindViewById<RatingCircle>(Resource.Id.rating_circle);
circleImage = view.FindViewById<CircleImageView>(Resource.Id.profile_image);
viewModel = new ProfileViewModel();
Square.Picasso.Picasso.With(Activity).Load(Settings.Current.UserProfileUrl).Into(circleImage);
trips = view.FindViewById<TextView>(Resource.Id.text_trips);
time = view.FindViewById<TextView>(Resource.Id.text_time);
distance = view.FindViewById<TextView>(Resource.Id.text_distance);
maxSpeed = view.FindViewById<TextView>(Resource.Id.text_max_speed);
fuelUsed = view.FindViewById<TextView>(Resource.Id.text_fuel_consumption);
accelerations = view.FindViewById<TextView>(Resource.Id.text_hard_accelerations);
stops = view.FindViewById<TextView>(Resource.Id.text_hard_breaks);
profileAll = view.FindViewById<LinearLayout>(Resource.Id.text_profile_all);
profileGreat = view.FindViewById<TextView>(Resource.Id.text_profile_great);
profileRating = view.FindViewById<TextView>(Resource.Id.text_profile_rating);
profileAll.Visibility = ViewStates.Invisible;
UpdateUI();
return view;
}
示例9: ForwardNavigationMenu
public ForwardNavigationMenu(Context context, IAttributeSet attrs, int defStyle)
: base(context, attrs, defStyle)
{
_mainContainer = new LinearLayout (context);
_mainContainer.Orientation = Android.Widget.Orientation.Vertical;
_mainContainer.LayoutParameters = new LayoutParams (LayoutParams.MatchParent, LayoutParams.MatchParent);
_context = context;
var dm = Resources.DisplayMetrics;
textSize = (int)TypedValue.ApplyDimension (ComplexUnitType.Sp, textSize, dm);
var a = context.ObtainStyledAttributes (attrs, Attrs);
a = context.ObtainStyledAttributes (attrs, Resource.Styleable.ForwardNavigationMenu);
contentPadding = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmContentPadding, contentPadding);
padding = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPadding, padding);
paddingLeft = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingLeft, paddingLeft);
paddingBottom = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingBottom, paddingBottom);
paddingRight = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingRight, paddingRight);
paddingTop = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmPaddingTop, paddingTop);
margin = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMargin, margin);
marginRight = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginRight, marginRight);
marginLeft = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginLeft, marginLeft);
marginBottom = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginBottom, marginBottom);
marginTop = a.GetDimensionPixelSize (Resource.Styleable.ForwardNavigationMenu_fnmMarginTop, marginTop);
typefaceStyle = (TypefaceStyle)a.GetInt (Resource.Styleable.ForwardNavigationMenu_fnmTextStyle, (int)TypefaceStyle.Normal);
textAlpha = a.GetInt (Resource.Styleable.ForwardNavigationMenu_fnmTextAlpha, textAlpha);
a.Recycle ();
_mainContainer.SetPadding (contentPadding, contentPadding, contentPadding, contentPadding);
AddView (_mainContainer);
}
示例10: OnCreate
protected override void OnCreate (Bundle savedInstanceState)
{
base.OnCreate (savedInstanceState);
SetContentView (Resource.Layout.AddPhotoPopUpLayout);
optionalCaption = (EditText)FindViewById (Resource.Id.photoPopupDescription);
optionalCaption.Enabled = !Assignment.IsHistory;
dateTime = (TextView)FindViewById (Resource.Id.photoDateTime);
photoCount = (TextView)FindViewById (Resource.Id.photoCountText);
deletePhoto = (LinearLayout)FindViewById (Resource.Id.photoDeleteImage);
deletePhoto.Enabled = !Assignment.IsHistory;
deletePhoto.Click += (sender, e) => DeletePhoto ();
var nextPhoto = (ImageButton)FindViewById (Resource.Id.photoNextButton);
var previousPhoto = (ImageButton)FindViewById (Resource.Id.photoPreviousButton);
var cancel = (Button)FindViewById (Resource.Id.photoCancelImage);
cancel.Click += (sender, e) => Dismiss ();
var done = (Button)FindViewById (Resource.Id.photoDoneImage);
done.Click += (sender, e) => SavePhoto ();
photo = (ImageView)FindViewById (Resource.Id.photoImageSource);
nextPhoto.Visibility =
previousPhoto.Visibility =
photoCount.Visibility = ViewStates.Invisible;
}
示例11: Initialize
void Initialize ()
{
this.LayoutParameters = new RelativeLayout.LayoutParams(-1,-1);
this.SetGravity(GravityFlags.CenterHorizontal);
mainLinearLayout = new LinearLayout (context);
mainLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);
mainLinearLayout.Orientation = Orientation.Vertical;
imBack = new ImageView (context);
txtDescription = new TextView (context);
txtTitle = new TextView (context);
txtTitle.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(38));
txtDescription.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(32));
txtTitle.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
txtDescription.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
int padW = Configuration.getWidth(30);
int padH = Configuration.getHeight (0);
this.SetPadding (padW,padH,padW,padH);
mainLinearLayout.AddView (txtTitle);
mainLinearLayout.AddView (imBack);
mainLinearLayout.AddView (txtDescription);
this.AddView (mainLinearLayout);
//this.AddView (background);
}
示例12: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
RequestWindowFeature (WindowFeatures.ActionBarOverlay);
ActionBar.SetBackgroundDrawable (new ColorDrawable (Color.Transparent));
SetContentView (Resource.Layout.Main);
var list = FindViewById<OverscrollListView> (Resource.Id.listView1);
loadingBars = FindViewById<LinearLayout> (Resource.Id.loadingBars);
bar1 = FindViewById<ProgressBar> (Resource.Id.loadingBar1);
bar2 = FindViewById<ProgressBar> (Resource.Id.loadingBar2);
swipeText = FindViewById<TextView> (Resource.Id.swipeToRefreshText);
// Remove progress bar background
foreach (var p in new[] { bar1, bar2 }) {
var layer = p.ProgressDrawable as LayerDrawable;
if (layer != null)
layer.SetDrawableByLayerId (Android.Resource.Id.Background,
new ColorDrawable (Color.Transparent));
}
list.OverScrolled += deltaY => {
ShowSwipeDown ();
accumulatedDeltaY += -deltaY;
bar1.Progress = bar2.Progress = accumulatedDeltaY;
if (accumulatedDeltaY == 0)
HideSwipeDown ();
};
list.OverScrollCanceled += HideSwipeDown;
}
示例13: Login
public override void Login(LoginConfig config)
{
var context = Utils.GetActivityContext();
var txtUser = new EditText(context) {
Hint = config.LoginPlaceholder,
Text = config.LoginValue ?? String.Empty
};
var txtPass = new EditText(context) {
Hint = config.PasswordPlaceholder,
TransformationMethod = PasswordTransformationMethod.Instance
};
var layout = new LinearLayout(context) {
Orientation = Orientation.Vertical
};
layout.AddView(txtUser, ViewGroup.LayoutParams.MatchParent);
layout.AddView(txtPass, ViewGroup.LayoutParams.MatchParent);
Utils.RequestMainThread(() =>
new AlertDialog
.Builder(Utils.GetActivityContext())
.SetTitle(config.Title)
.SetMessage(config.Message)
.SetView(layout)
.SetPositiveButton(config.OkText, (o, e) =>
config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, true))
)
.SetNegativeButton(config.CancelText, (o, e) =>
config.OnResult(new LoginResult(txtUser.Text, txtPass.Text, false))
)
.Show()
);
}
示例14: NavToolbarFragment
public NavToolbarFragment( ) : base( )
{
BackButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
ShareButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
CreateButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
ButtonLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
}
示例15: OnCreateDialogView
protected override View OnCreateDialogView()
{
var layout = new LinearLayout(_context) {Orientation = Orientation.Vertical};
layout.SetPadding(10, 10, 10, 10);
layout.SetBackgroundColor(Color.Black);
_serverUrl = new TextView(_context) {Text = "Server url:"};
_serverUrl.SetTextColor(Color.White);
_serverUrl.SetPadding(0, 8, 0, 3);
_serverUrlBox = new EditText(_context);
_serverUrlBox.SetSingleLine(true);
_userKey = new TextView(_context) {Text = "User key:"};
_userKey.SetTextColor(Color.White);
_userKeyBox = new EditText(_context);
_userKeyBox.SetSingleLine(true);
layout.AddView(_serverUrl);
layout.AddView(_serverUrlBox);
layout.AddView(_userKey);
layout.AddView(_userKeyBox);
return layout;
}