本文整理汇总了C#中LinearLayout.SetOnClickListener方法的典型用法代码示例。如果您正苦于以下问题:C# LinearLayout.SetOnClickListener方法的具体用法?C# LinearLayout.SetOnClickListener怎么用?C# LinearLayout.SetOnClickListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinearLayout
的用法示例。
在下文中一共展示了LinearLayout.SetOnClickListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitViews
/// <summary>
/// 初始化
/// </summary>
private void InitViews()
{
mTabBtnHealth = FindViewById<LinearLayout> (Resource.Id.id_tab_bottom_health);
mTabBtnAlarm = FindViewById<LinearLayout> (Resource.Id.id_tab_bottom_alarm);
mTabBtnGuardian = FindViewById<LinearLayout> (Resource.Id.id_tab_bottom_guardian);
mTabBtnMy = FindViewById<LinearLayout> (Resource.Id.id_tab_bottom_my);
//设置触发事件
mTabBtnHealth.SetOnClickListener (this);
mTabBtnAlarm.SetOnClickListener (this);
mTabBtnGuardian.SetOnClickListener (this);
mTabBtnMy.SetOnClickListener (this);
}
示例2: InitViews
/// <summary>
/// 初始化
/// </summary>
private void InitViews()
{
ll_tab_bottom_server = FindViewById<LinearLayout> (Resource.Id.ll_tab_bottom_server);
ll_tab_bottom_my = FindViewById<LinearLayout> (Resource.Id.ll_tab_bottom_my);
ll_tab_bottom_finance = FindViewById<LinearLayout> (Resource.Id.ll_tab_bottom_finance);
btn_tab_bottom_server = ll_tab_bottom_server.FindViewById<ImageButton> (Resource.Id.btn_tab_bottom_server);
tv_tab_bottom_server = ll_tab_bottom_server.FindViewById<TextView> (Resource.Id.tv_tab_bottom_server);
btn_tab_bottom_finance = ll_tab_bottom_finance.FindViewById<ImageButton> (Resource.Id.btn_tab_bottom_finance);
tv_tab_bottom_finance = ll_tab_bottom_finance.FindViewById<TextView> (Resource.Id.tv_tab_bottom_finance);
btn_tab_bottom_my = ll_tab_bottom_my.FindViewById<ImageButton> (Resource.Id.btn_tab_bottom_my);
tv_tab_bottom_my = ll_tab_bottom_my.FindViewById<TextView> (Resource.Id.tv_tab_bottom_my);
//设置触发事件
ll_tab_bottom_server.SetOnClickListener (this);
ll_tab_bottom_finance.SetOnClickListener (this);
ll_tab_bottom_my.SetOnClickListener (this);
}
示例3: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
//游戏开始
ImageView imgStart = FindViewById<ImageView>(Resource.Id.imgStart);
imgStart.Click += delegate
{
var intent = new Intent(this, typeof(GameActivity));
intent.PutExtra("game", GameIndex);
StartActivityForResult(intent, 0);
Finish();
};
//游戏退出
ImageView imgExit = FindViewById<ImageView>(Resource.Id.imgExit);
imgExit.Click += delegate
{
Finish();
};
//绑定关卡列表
glBarriers = FindViewById<GridLayout>(Resource.Id.glBarriers);
//BarrierList = _db.QueryAllBarriers();
BarrierList = new List<Barrier>();
var names = Resources.GetStringArray(Resource.Array.barrier_names);
var titles = Resources.GetStringArray(Resource.Array.barrier_titles);
for (int i = 0; i < names.Length; i++)
{
var barrier = DB.QueryBarrier(i);
if (barrier == null)
{
barrier = new Barrier() { Id = i, Title = titles[i], Name = names[i], Star = 0, State = (i == 0 ? true : false), NextID = (i == names.Length - 1) ? 0 : (i + 1) };
DB.Insert(barrier);
}
BarrierList.Add(barrier);
LinearLayout linear = new LinearLayout(this);
GridLayout.LayoutParams g = new GridLayout.LayoutParams();
g.Width = GridLayout.LayoutParams.WrapContent;
g.Height = GridLayout.LayoutParams.WrapContent;
if (Resources.DisplayMetrics.Density == 1)
{
g.SetMargins(17, 20, 17, 20);
}
else
{
g.SetMargins(17, 20, 17, 20);
}
linear.LayoutParameters = g;
linear.Orientation = Orientation.Vertical;
linear.SetGravity(GravityFlags.Center);
linear.Clickable = false;
LinearLayout linearLayout = new LinearLayout(this);
LinearLayout.LayoutParams m = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
linearLayout.LayoutParameters = m;
if (barrier.State)
{
linearLayout.SetBackgroundResource(Resource.Drawable.home_icon_on);
}
else if (!barrier.State)
{
linearLayout.SetBackgroundResource(Resource.Drawable.home_icon_off);
}
linearLayout.SetGravity(GravityFlags.Bottom);
linearLayout.Orientation = Orientation.Vertical;
linearLayout.Id = barrier.Id;
linearLayout.SetOnClickListener(this);
if (barrier.Id == 0)
{
linearLayout.SetBackgroundResource(Resource.Drawable.home_icon_on_selected);
}
TextView textView = new TextView(this);
LinearLayout.LayoutParams t = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, LinearLayout.LayoutParams.WrapContent);
if (Resources.DisplayMetrics.Density == 1)
{
t.BottomMargin = 10;
textView.SetTextSize(Android.Util.ComplexUnitType.Sp, 15);
}
else
{
t.BottomMargin = 5;
textView.SetTextSize(Android.Util.ComplexUnitType.Sp, 10);
}
textView.LayoutParameters = t;
textView.Text = barrier.Title;
textView.SetTextColor(Android.Graphics.Color.White);
textView.Gravity = GravityFlags.Center;
linearLayout.AddView(textView);
LinearLayout ll = new LinearLayout(this);
LinearLayout.LayoutParams l = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);
ll.LayoutParameters = l;
ll.Orientation = Orientation.Horizontal;
ll.SetGravity(GravityFlags.Center);
for (int j = 1; j <= 3; j++)
{
ImageView imageView = new ImageView(this);
LinearLayout.LayoutParams imageLayout;
if (Resources.DisplayMetrics.Density == 1)
//.........这里部分代码省略.........