本文整理汇总了C#中ImageButton.SetMinimumWidth方法的典型用法代码示例。如果您正苦于以下问题:C# ImageButton.SetMinimumWidth方法的具体用法?C# ImageButton.SetMinimumWidth怎么用?C# ImageButton.SetMinimumWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageButton
的用法示例。
在下文中一共展示了ImageButton.SetMinimumWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitView
public void InitView(List<BookingDocumentDto> _bookingDocs) {
this.RemoveAllViews ();
int size = _bookingDocs.Count;
for(int i = 0; i < size; i ++) {
LinearLayout ll = new LinearLayout (_context);
ll.Orientation = Orientation.Horizontal;
ll.SetVerticalGravity (GravityFlags.CenterVertical);
ImageView imgFile = new ImageView (_context);
imgFile.SetImageResource (Resource.Drawable.ic_attach);
var tvFileAttach = new TextView (_context) {
Text = _bookingDocs[i].OriginalFileName
};
tvFileAttach.Id = i;
tvFileAttach.SetTextColor (Color.Blue);
tvFileAttach.PaintFlags = PaintFlags.UnderlineText;
tvFileAttach.SetTypeface (null, TypefaceStyle.Bold);
tvFileAttach.SetSingleLine (true);
tvFileAttach.Ellipsize = global::Android.Text.TextUtils.TruncateAt.Middle;
tvFileAttach.SetPadding (5, 0, 10, 0);
LayoutParams param = new TableRow.LayoutParams(0, LayoutParams.WrapContent, 1f);
tvFileAttach.LayoutParameters = param;
tvFileAttach.Click += (sender, e) => {
utilsAndroid.onViewFile(_context, _bookingDocs[tvFileAttach.Id].S3FileName);
};
ImageButton imgDelete = new ImageButton (_context);
imgDelete.Id = i;
imgDelete.SetImageResource (Resource.Drawable.ic_delete);
imgDelete.SetMinimumWidth (50);
imgDelete.SetMinimumHeight (50);
imgDelete.SetBackgroundColor (Color.Transparent);
imgDelete.Click += (sender, e) => {
_deleteFile.onDeleteFile(_isInConference, _bookingDocs[imgDelete.Id]);
};
ll.AddView (imgFile);
ll.AddView (tvFileAttach);
ll.AddView (imgDelete);
ll.SetPadding (0, 5, 0, 5);
this.AddView (ll);
}
}
示例2: GetPasswordAsync
public Task<string> GetPasswordAsync(Stream keypadImageStream, IList<MapAreaInfo> mapAreas, SiteManager site)
{
var tcs = new TaskCompletionSource<string>();
var adb = new AlertDialog.Builder(Context);
using (var inflater = LayoutInflater.From(adb.Context))
{
var view = inflater.Inflate(Resource.Layout.XjtuCardPassword, null);
var passwordView = view.FindViewById<TextView>(Resource.Id.passwordTextView);
var padTable = view.FindViewById<TableLayout>(Resource.Id.passwordPadTable);
var currentPassword = "";
Action updatePasswordDisplay = () =>
{
passwordView.Text = new string('#', currentPassword.Length);
};
//生成按键。
var keypadBitmap = BitmapFactory.DecodeStream(keypadImageStream);
for (var row = 0; row < 4; row++)
{
var tr = new TableRow(adb.Context)
{
LayoutParameters = new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.WrapContent,
ViewGroup.LayoutParams.WrapContent)
};
padTable.AddView(tr);
for (var col = 0; col < 3; col++)
{
var index = row * 3 + col;
var indexExpr = Convert.ToString(index);
View buttonView = null;
if (index <= 9)
{
var area = mapAreas.First(a => a.Value == indexExpr);
var button = new ImageButton(adb.Context)
{
LayoutParameters = new TableRow.LayoutParams(
ViewGroup.LayoutParams.WrapContent,
ViewGroup.LayoutParams.WrapContent),
};
button.SetMinimumWidth(DroidUtility.DipToPixelsX(64));
button.SetMinimumHeight(DroidUtility.DipToPixelsY(64));
button.SetImageBitmap(Bitmap.CreateBitmap(keypadBitmap, area.X1, area.Y1, area.Width, area.Height));
button.SetScaleType(ImageView.ScaleType.FitCenter);
button.Click += (_, e) =>
{
currentPassword += indexExpr;
updatePasswordDisplay();
};
buttonView = button;
} else if (index == 10)
{
var button = new Button(adb.Context)
{
Text = "更正",
LayoutParameters = new TableRow.LayoutParams(
ViewGroup.LayoutParams.MatchParent,
ViewGroup.LayoutParams.WrapContent)
{
Span = 2,
Gravity = GravityFlags.CenterVertical
}
};
button.Click += (_, e) =>
{
currentPassword = "";
updatePasswordDisplay();
};
buttonView = button;
}
if (buttonView != null)
{
tr.AddView(buttonView);
}
}
}
//初始化界面。
updatePasswordDisplay();
adb.SetView(view)
.SetPositiveButton("确定", (_, e) =>
{
tcs.SetResult(currentPassword);
})
.SetNegativeButton("取消", (_, e) =>
{
tcs.SetResult(null);
})
.Show();
}
return tcs.Task;
}