本文整理汇总了C#中ImageView类的典型用法代码示例。如果您正苦于以下问题:C# ImageView类的具体用法?C# ImageView怎么用?C# ImageView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageView类属于命名空间,在下文中一共展示了ImageView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreateView
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (container == null) {
// Currently in a layout without a container, so no reason to create our view.
return null;
}
var view = inflater.Inflate(Resource.Layout.animal_screen, container, false);
var animal = EvolveData.AnimalData [ShownAnimalIndex];
headshotImageView = view.FindViewById<ImageView> (Resource.Id.headshotImageView);
//var headshot = GetHeadShot (animal.HeadshotUrl);
//headshotImageView.SetImageDrawable (headshot);
animalNameTextView = view.FindViewById<TextView> (Resource.Id.animalNameTextView);
animalNameTextView.Text = animal.Name;
speciesNameTextView = view.FindViewById<TextView> (Resource.Id.speciesNameTextView);
speciesNameTextView.Text = animal.Species;
twitterHandleView = view.FindViewById<TextView> (Resource.Id.twitterTextView);
//twitterHandleView.Text = "@" + animal.TwitterHandle;
return view;
}
示例2: OnCreate
protected override void OnCreate(Bundle savedInstanceState)
{
try
{
base.OnCreate(savedInstanceState);
_task = Rep.DatabaseHelper.Tasks.Enumerator.Current;
var category = Rep.DatabaseHelper.Tasks.GetCategory(_task.CategoryId);
SetContentView(Resource.Layout.ImageCard);
_image = FindViewById<ImageView>(Resource.Id.imageCardView);
var imageIdentifier = this.Resources.GetIdentifier(category.Image, "drawable", this.PackageName);
_image.SetImageResource(imageIdentifier);
var text = FindViewById<TextView>(Resource.Id.textCard);
text.SetTypeface(Rep.FontManager.Get(Font.BankirRetro), TypefaceStyle.Normal);
text.Text = _task.TaskName;
_contentFrameLayout = FindViewById(Resource.Id.contentFrameLayout);
_contentFrameLayout.Click += ContentFrameLayoutOnClick;
}
catch (Exception exception)
{
GaService.TrackAppException(this.Class,"OnCreate", exception, false);
base.OnBackPressed();
}
}
示例3: OnCreateView
public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
if (container == null) {
// Currently in a layout without a container, so no reason to create our view.
return null;
}
var view = inflater.Inflate(Resource.Layout.speaker_screen, container, false);
var speaker = EvolveData.SpeakerData [ShownSpeakerIndex];
headshotImageView = view.FindViewById<ImageView> (Resource.Id.headshotImageView);
var headshot = GetHeadShot (speaker.HeadshotUrl);
headshotImageView.SetImageDrawable (headshot);
speakerNameTextView = view.FindViewById<TextView> (Resource.Id.speakerNameTextView);
speakerNameTextView.Text = speaker.Name;
companyNameTextView = view.FindViewById<TextView> (Resource.Id.companyNameTextView);
companyNameTextView.Text = speaker.Company;
twitterHandleView = view.FindViewById<TextView> (Resource.Id.twitterTextView);
twitterHandleView.Text = "@" + speaker.TwitterHandle;
return view;
}
示例4: GetView
public override View GetView(Context context, View convertView, ViewGroup parent)
{
this.Click = delegate { SelectImage(); };
Bitmap scaledBitmap = Bitmap.CreateScaledBitmap(_image, dimx, dimy, true);
var view = convertView as RelativeLayout;
if (view == null)
{
view = new RelativeLayout(context);
_imageView = new ImageView(context);
}
else
{
_imageView = (ImageView)view.GetChildAt(0);
}
_imageView.SetImageBitmap(scaledBitmap);
var parms = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
parms.SetMargins(5, 2, 5, 2);
parms.AddRule( LayoutRules.AlignParentLeft);
if(_imageView.Parent != null && _imageView.Parent is ViewGroup)
((ViewGroup)_imageView.Parent).RemoveView(_imageView);
view.AddView(_imageView, parms);
return view;
}
示例5: OnCreate
//Metodo principal en el cual se creara el servicio y pintaremos nuestro imageview sobre la ventana
public override void OnCreate ()
{
base.OnCreate ();
//incializaremos en windowmanager obteniendo el servicio directo de la ventan del sistema y haremos
//un casting de tipo JavaCast<IWindowManager>
windowManager = GetSystemService ("window").JavaCast<IWindowManager> ();
//inicializaremos nuestro imageview dandole los atributos de nuestra clase para que obtenga los metodos
//de touch
chatHead = new ImageView(this);
//definimos la imagen del imageview
chatHead.SetImageResource (Resource.Drawable.ic_launcher);
//Asignamos el listener del touch nuestra clase del tipo View.IOnTouchListener
chatHead.SetOnTouchListener (this);
//instanciamos los parametros que necesitamos para poder tomar la pantalla y asi poder mostrar nuestro imageview
param = new WindowManagerLayoutParams(
WindowManagerLayoutParams.WrapContent,
WindowManagerLayoutParams.WrapContent,
WindowManagerTypes.Phone,
WindowManagerFlags.NotFocusable,
Format.Translucent);
//Agregamos la propiedad de gravedad en la parte de arriba hacia la izquieda
param.Gravity = GravityFlags.Top | GravityFlags.Left;
//Asignamos la posicion X del imageview
param.X = 0;
//Asignamos la posicion Y del imageview
param.Y = 100;
//Agregamos una vista a la ventana del sistema con nuestro imageview y los parametros generados
windowManager.AddView (chatHead, param);
}
示例6: SetUrlDrawable
private static void SetUrlDrawable(Context context, ImageView imageView, string url, int defaultResource, long cacheDurationMs)
{
Drawable d = null;
if (defaultResource != 0)
d = imageView.Resources.GetDrawable(defaultResource);
SetUrlDrawable(context, imageView, url, d, cacheDurationMs, null);
}
示例7: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate (bundle);
SetContentView (Resource.Layout.NewsItem);
var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
//Toolbar will now take on default actionbar characteristics
SetSupportActionBar (toolbar);
SupportActionBar.Title = "Nachrichten";
SupportActionBar.SetDisplayHomeAsUpEnabled (true);
SupportActionBar.SetHomeButtonEnabled (true);
_settings = new Settings (this);
_thatThing = _settings.ReadNews ("lastClick");
var type = Typeface.CreateFromAsset (Assets, "SourceSansPro-Regular.ttf");
var bold = Typeface.CreateFromAsset (Assets, "SourceSansPro-Bold.ttf");
Title = _thatThing.SourcePrint;
_main = FindViewById<TextView> (Resource.Id.mainText);
_title = FindViewById<TextView> (Resource.Id.title);
_icon = FindViewById<ImageView> (Resource.Id.icon);
_main.Text = _thatThing.Content;
_main.Typeface = type;
_title.Text = _thatThing.Title;
_title.Typeface = bold;
_icon.SetUrlDrawable (_thatThing.Image, Resource.Drawable.notifications);
}
示例8: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
if (IsThereAnAppToTakePictures())
{
CreateDirectoryForPictures();
Button button = FindViewById<Button>(Resource.Id.myButton);
_imageView = FindViewById<ImageView>(Resource.Id.imageView1);
button.Click += TakeAPicture;
}
else
{
// No app for taking pictures exists on the phone :(
MessageBox.Show("There is no camera app installed on this phone. Please install one.", "Error", this);
}
//// Get our button from the layout resource,
//// and attach an event to it
//Button button = FindViewById<Button>(Resource.Id.MyButton);
//button.Click += delegate { button.Text = string.Format("{0} clicks!", count++) + Test.TEXT; };
}
示例9: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
ImageView img = new ImageView(this);
img.SetImageResource(Resource.Drawable.spadeicon);
var root = new RootElement("Test Root Elem")
{
new Section("Test Header", "Test Footer")
{
new BooleanElement("Push my button", true),
new BooleanElement("Push this too", false),
new StringElement("Text label", "The Value"),
new BooleanElement("Push my button", true),
new BooleanElement("Push this too", false),
},
new Section("Part II")
{
new StringElement("This is the String Element", "The Value"),
new CheckboxElement("Check this out", true),
new ImageElement(img),
new HtmlElement("Go to Google.com","http://www.google.com")
}
};
var da = new DialogAdapter(this, root);
var lv = new ListView(this) {Adapter = da};
SetContentView(lv);
}
示例10: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
//TODO: Step 9 - Add a Gesture Overlay View as the primary view
// This activity will use a GestureOverlayView as it's content view. The layout file
// will be added as a subview of this.
GestureOverlayView gestureOverlayView = new GestureOverlayView(this);
SetContentView(gestureOverlayView);
//TODO: Step 10 - Subscribe to gesture events
gestureOverlayView.GesturePerformed += GestureOverlayViewOnGesturePerformed;
//TODO: Step 11 - Load the gestures from the raw resource
// Load the binary gesture file that we created.
_gestureLibrary = GestureLibraries.FromRawResource(this, Resource.Raw.gestures);
if (!_gestureLibrary.Load())
{
Log.Error(GetType().FullName, "There was a problem loading the gesture library.");
Finish();
}
// Load up the layout file for this activity and add it as child view of the
// GestureOverlayView
View view = LayoutInflater.Inflate(Resource.Layout.custom_gesture_layout, null);
_imageView = view.FindViewById<ImageView>(Resource.Id.imageView1);
gestureOverlayView.AddView(view);
}
示例11: OnCreateView
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
mRootView = inflater.Inflate(Resource.Layout.fragment_theme, container, false);
mViewTheme = mRootView.FindViewById<BandThemeView>(Resource.Id.viewTheme);
mButtonGetTheme = mRootView.FindViewById<Button>(Resource.Id.buttonGetTheme);
mButtonGetTheme.Click += OnGetThemeClick;
mButtonSetTheme = mRootView.FindViewById<Button>(Resource.Id.buttonSetTheme);
mButtonSetTheme.Click += OnSetThemeClick;
mButtonSelectBackground = mRootView.FindViewById<Button>(Resource.Id.buttonSelectBackground);
mButtonSelectBackground.Click += OnSelectBackgroundClick;
mImageBackground = mRootView.FindViewById<ImageView>(Resource.Id.imageBackground);
mButtonGetBackground = mRootView.FindViewById<Button>(Resource.Id.buttonGetBackground);
mButtonGetBackground.Click += OnGetBackgroundClick;
mButtonSetBackground = mRootView.FindViewById<Button>(Resource.Id.buttonSetBackground);
mButtonSetBackground.Click += OnSetBackgroundClick;
return mRootView;
}
示例12: setupImage
// void loadBackdrop()
// {
// var imageView = FindViewById<ImageView> (Resource.Id.backdrop);
// var random = Pictures.GetRandomBackground ();
// imageView.SetImageResource (random);
// }
// public override bool OnCreateOptionsMenu (IMenu menu)
// {
// MenuInflater.Inflate (Resource.Menu.sample_actions, menu);
// return true;
// }
private void setupImage(ImageView image, string url){
Picasso.With (MyVote.Const.context)
.Load (url)
.Placeholder (Resource.Drawable.placeholder_poster)
.Into(image);
}
示例13: Initialize
void Initialize ()
{
var inflater = (LayoutInflater)Context.GetSystemService (Context.LayoutInflaterService);
inflater.Inflate (Resource.Layout.TogglField, this);
// Workaround because the duplicated names
// inside the component breaks the
// databinding.
var layout = FindViewById<RelativeLayout> (Resource.Id.EditTimeEntryBit);
for (int i = 0; i < layout.ChildCount; i++) {
if (layout.GetChildAt (i) is EditText) {
TextField = (EditText)layout.GetChildAt (i);
}
}
titleText= FindViewById<TextView> (Resource.Id.EditTimeEntryBitTitle);
assistView = FindViewById<TextView> (Resource.Id.EditTimeEntryBitAssistView);
arrow = FindViewById<ImageView> (Resource.Id.EditTimeEntryBitArrow);
TextField.EditorAction += OnTextFieldEditorActionListener;
TextField.FocusChange += (sender, e) => {
titleText.Selected = TextField.HasFocus;
Selected = TextField.HasFocus;
};
}
示例14: OnCreate
protected async override void OnCreate(Bundle bundle)
{
try
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.ScheduleLayout);
schedules = new List<ScheduleModel>();
lv = (ListView)FindViewById(Resource.Id.lvSchedule);
connectivityPointer = FindViewById<ImageView>(Resource.Id.ivConnectionSchedule);
setConnectivityStatus(OnOffService.Online);
//Hier die Schedules des Benutzers abholen und in die Liste einfügen
ooService = new OnOffService();
userID = Intent.GetStringExtra("User");
Guid userId = new Guid(userID);
IEnumerable<ScheduleModel> temp = await ooService.GetAllSchedulesAsync(userId);
schedules = temp.ToList<ScheduleModel>();
//ArrayAdapter<string> adapter = new ArrayAdapter<string>(this, Resource.Layout.ScheduleView, Resource.Id.txtScheduleViewDescription, schedules);
ScheduleListViewAdapter adapter = new ScheduleListViewAdapter(this, schedules);
lv.Adapter = adapter;
lv.ItemClick += lv_ItemClick;
}
catch(ArgumentNullException ex)
{
Console.WriteLine("Keine UserId übergeben: " + ex.StackTrace);
}
catch(System.Exception exc)
{
Console.WriteLine("Fehler beim Erstellen des ScheduleViews: " + exc.StackTrace);
}
}
示例15: InitView
private void InitView()
{
//设置标题栏
var img_header_back = FindViewById<ImageView> (Resource.Id.img_header_back);
img_header_back.Click += (sender, e) =>
{
this.Finish();
OverridePendingTransition(Android.Resource.Animation.SlideInLeft,Android.Resource.Animation.SlideOutRight);
};
var tv_back = FindViewById<TextView> (Resource.Id.tv_back);
tv_back.Text = "返回";
var tv_desc = FindViewById<TextView> (Resource.Id.tv_desc);
tv_desc.Text = "银行卡信息";
edit_cardOwnerName = FindViewById<EditText> (Resource.Id.edit_cardOwnerName);
edit_IdCardNo = FindViewById<EditText> (Resource.Id.edit_IdCardNo);
edit_bankopenloc = FindViewById<EditText> (Resource.Id.edit_bankopenloc);
edit_bankbranch = FindViewById<EditText> (Resource.Id.edit_bankbranch);
edit_bankCardNo = FindViewById<EditText> (Resource.Id.edit_bankCardNo);
edit_prePhoneNo = FindViewById<EditText> (Resource.Id.edit_prePhoneNo);
edit_Code = FindViewById<EditText> (Resource.Id.edit_Code);
img_choosebank = FindViewById<ImageView> (Resource.Id.img_choosebank);
tv_SendCodeStatusShow = FindViewById<TextView> (Resource.Id.tv_SendCodeStatusShow);
cb_defaut_bank = FindViewById<CheckBox> (Resource.Id.cb_defaut_bank);
btn_Send = FindViewById<Button> (Resource.Id.btn_Send);
btn_Add = FindViewById<Button> (Resource.Id.btn_Add);
//选择银行卡
img_choosebank.Click += (sender, e) =>
{
var intent = new Intent(this,typeof(ChooseBankTypeActivity));
var requestCode = 0;
StartActivityForResult(intent,requestCode);
};
//安全码验证
edit_Code.TextChanged += (sender, e) =>
{
if(edit_Code.Text.Length>0)
btn_Add.Enabled = true;
else
btn_Add.Enabled =false;
};
//初始化计时器,启动
mc = new MyCount(this,60000,1000);
//发送验证码
btn_Send.Click += (sender, e) =>
{
tv_SendCodeStatusShow.Visibility = ViewStates.Invisible;
btn_Send.Enabled = false;
SendCode();
};
//添加银行卡信息
btn_Add.Click += (sender, e) =>
{
AddBank();
};
}