本文整理汇总了C#中Android.Content.Context.FromPixels方法的典型用法代码示例。如果您正苦于以下问题:C# Context.FromPixels方法的具体用法?C# Context.FromPixels怎么用?C# Context.FromPixels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Android.Content.Context
的用法示例。
在下文中一共展示了Context.FromPixels方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BaseCellView
public BaseCellView(Context context, Cell cell) : base(context)
{
_cell = cell;
SetMinimumWidth((int)context.ToPixels(25));
SetMinimumHeight((int)context.ToPixels(25));
Orientation = Orientation.Horizontal;
var padding = (int)context.FromPixels(8);
SetPadding(padding, padding, padding, padding);
_imageView = new ImageView(context);
var imageParams = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent)
{
Width = (int)context.ToPixels(60),
Height = (int)context.ToPixels(60),
RightMargin = 0,
Gravity = GravityFlags.Center
};
using (imageParams)
AddView(_imageView, imageParams);
var textLayout = new LinearLayout(context) { Orientation = Orientation.Vertical };
_mainText = new TextView(context);
_mainText.SetSingleLine(true);
_mainText.Ellipsize = TextUtils.TruncateAt.End;
_mainText.SetPadding((int)context.ToPixels(15), padding, padding, padding);
_mainText.SetTextAppearanceCompat(context, global::Android.Resource.Style.TextAppearanceSmall);
using (var lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent))
textLayout.AddView(_mainText, lp);
_detailText = new TextView(context);
_detailText.SetSingleLine(true);
_detailText.Ellipsize = TextUtils.TruncateAt.End;
_detailText.SetPadding((int)context.ToPixels(15), padding, padding, padding);
_detailText.Visibility = ViewStates.Gone;
_detailText.SetTextAppearanceCompat(context, global::Android.Resource.Style.TextAppearanceSmall);
using (var lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent))
textLayout.AddView(_detailText, lp);
var layoutParams = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent) { Width = 0, Weight = 1, Gravity = GravityFlags.Center };
using (layoutParams)
AddView(textLayout, layoutParams);
SetMinimumHeight((int)context.ToPixels(DefaultMinHeight));
_androidDefaultTextColor = Color.FromUint((uint)_mainText.CurrentTextColor);
}