本文整理汇总了C#中Fragment类的典型用法代码示例。如果您正苦于以下问题:C# Fragment类的具体用法?C# Fragment怎么用?C# Fragment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Fragment类属于命名空间,在下文中一共展示了Fragment类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawingImageView
public DrawingImageView(Context context, Fragment fragment): base(context) {
mPaint = new Paint();
mPaint.AntiAlias = true;
mPaint.Dither = true;
mPaint.Color = Color.Yellow;
mPaint.SetStyle (Paint.Style.Stroke);
mPaint.StrokeJoin = Paint.Join.Round;
mPaint.StrokeCap = Paint.Cap.Round;
mPaint.StrokeWidth = 10;
cPaint = new Paint ();
cPaint.Color = Color.Yellow;
cPaint.StrokeJoin = Paint.Join.Round;
cPaint.StrokeCap = Paint.Cap.Round;
cPaint.SetTypeface(Typeface.Default);
cPaint.TextSize = 40;
mPath = new Android.Graphics.Path();
mBitmapPaint = new Paint();
mBitmapPaint.Color = Color.Yellow;
DrawingStatus = DrawingType.None;
_fragment = fragment;
}
示例2: OnCreate
protected override void OnCreate(Bundle savedInstanceState) {
base.OnCreate(savedInstanceState);
SetContentView(R.Layouts.fragment_menu);
// Make sure the two menu fragments are created.
FragmentManager fm = GetSupportFragmentManager();
FragmentTransaction ft = fm.BeginTransaction();
mFragment1 = fm.FindFragmentByTag("f1");
if (mFragment1 == null) {
mFragment1 = new MenuFragment();
ft.Add(mFragment1, "f1");
}
mFragment2 = fm.FindFragmentByTag("f2");
if (mFragment2 == null) {
mFragment2 = new Menu2Fragment();
ft.Add(mFragment2, "f2");
}
ft.Commit();
// Watch check box clicks.
mCheckBox1 = (CheckBox)FindViewById(R.Ids.menu1);
mCheckBox1.Click += (o,a) => UpdateFragmentVisibility();
mCheckBox2 = (CheckBox)FindViewById(R.Ids.menu2);
mCheckBox2.Click += (o,a) => UpdateFragmentVisibility();
// Make sure fragments start out with correct visibility.
UpdateFragmentVisibility();
}
示例3: OnCreate
protected override void OnCreate (Bundle bundle)
{
RequestWindowFeature(WindowFeatures.NoTitle);
base.OnCreate (bundle);
this.SetContentView(Resource.Layout.Home);
String package = PackageName;
Glistener = new GestureListener();
Gdetector = new GestureDetector (this, Glistener);
var trans = FragmentManager.BeginTransaction ();
trans.Add (Resource.Id.frame_home,mHomeFragment3,"HomeFragment3");
trans.Hide (mHomeFragment3);
trans.Add (Resource.Id.frame_home,mHomeFragment2,"HomeFragment2");
trans.Hide (mHomeFragment2);
trans.Add (Resource.Id.frame_home,mHomeFragment1,"HomeFragment1");
trans.Commit();
currentFragment = mHomeFragment1;
Button haz_plif = FindViewById <Button> (Resource.Id.haz_plif);
FrameLayout fcontainer = FindViewById<FrameLayout> (Resource.Id.frame_home);
haz_plif.Click += (object sender, EventArgs e) => {
StartActivity(typeof(login));
Finish ();
};
fcontainer.Touch += Fcontainer_Touch;
RemoteViews rmv = new RemoteViews(package, Resource.Layout.Home);
rmv.SetTextViewText(Resource.Id.haz_plif,"Elias was here");
}
示例4: AddTab
public static void AddTab(this Activity context, string tabText, int? iconResourceId, int containerId, Fragment view)
{
var tab = context.ActionBar.NewTab();
tab.SetText(tabText);
if (iconResourceId != null)
{
tab.SetIcon(iconResourceId.Value);
}
// must set event handler before adding tab
tab.TabSelected += delegate (object sender, ActionBar.TabEventArgs e)
{
var fragment = context.FragmentManager.FindFragmentById(Resource.Id.settingsContainer);
if (fragment != null)
e.FragmentTransaction.Remove(fragment);
e.FragmentTransaction.Add(containerId, view);
};
tab.TabUnselected += delegate (object sender, ActionBar.TabEventArgs e) {
e.FragmentTransaction.Remove(view);
};
context.ActionBar.AddTab(tab);
}
示例5: TryCreateFragment
public bool TryCreateFragment(StringCursor text, out Fragment fragment)
{
ITextSplitter textSplitter = new SeparatorTextSplitter(text, new[] {'\r', '\n'});
fragment = new DelimitedFragment(textSplitter, _fragmentFactory);
return true;
}
示例6: InstanceReference
public InstanceReference(Fragment fragment, string instanceId)
{
if (fragment == null) throw new ArgumentNullException("fragment");
Instance = fragment;
InstanceId = instanceId ?? string.Empty;
}
示例7: OnCreateView
public override View OnCreateView(LayoutInflater Inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = Inflater.Inflate(R.Layout.fragment_menu, container, false);
// Make sure the two menu fragments are created.
FragmentManager fm = GetChildFragmentManager();
FragmentTransaction ft = fm.BeginTransaction();
mFragment1 = fm.FindFragmentByTag("f1");
if (mFragment1 == null) {
mFragment1 = new FragmentMenuSupport.MenuFragment();
ft.Add(mFragment1, "f1");
}
mFragment2 = fm.FindFragmentByTag("f2");
if (mFragment2 == null) {
mFragment2 = new FragmentMenuSupport.Menu2Fragment();
ft.Add(mFragment2, "f2");
}
ft.Commit();
// Watch check box clicks.
mCheckBox1 = (CheckBox)v.FindViewById(R.Id.menu1);
mCheckBox1.Click += (o, a) => UpdateFragmentVisibility();
mCheckBox2 = (CheckBox)v.FindViewById(R.Id.menu2);
mCheckBox2.Click += (o, a) => UpdateFragmentVisibility();
// Make sure fragments start out with correct visibility.
UpdateFragmentVisibility();
return v;
}
示例8: Add
public override void Add(Fragment fragment, IList<Fragment> fragments)
{
if (fragments.Count > 0)
{
Fragment prev = fragments[fragments.Count - 1];
if (prev.Name == fragment.Name)
{
if (prev.Value.Length < fragment.Value.Length)
{
Add(fragment, prev.ChildFragments);
return;
}
else if (prev.Value.Length > fragment.Value.Length)
{
for (int i = fragments.Count - 1; i >= 0; i--)
{
if (fragments[i].Name != fragment.Name)
break;
if (fragments[i].Value.Length < fragment.Value.Length)
{
base.Add(fragment, fragments[i].ChildFragments);
}
}
}
}
}
base.Add(fragment, fragments);
}
示例9: UINavigationController
public UINavigationController(Fragment root)
{
ControllerStack.Add (root);
if (root is IViewController) {
((IViewController)root).NavigationController = this;
}
}
示例10: OnAddingFragment
// méthode à appeler quand on déponse un fragment sur le musicien
public void OnAddingFragment(Fragment fragment)
{
print("NPC:OnAddingFragment");
SetJustReceivedFragmentComplete(true); // setting de la variable RAIN
Material addedMaterial;
switch(fragment.family){ // récupération du matérial correspondant au fragment qui vient d'être ajouté au musicien
case FragmentType.electricity:
addedMaterial = elecMaterial;
break;
case FragmentType.liquid:
addedMaterial = liquidMaterial;
break;
case FragmentType.metal:
addedMaterial = metalMaterial;
break;
case FragmentType.urban:
addedMaterial = urbanMaterial;
break;
case FragmentType.wood:
addedMaterial = woodMaterial;
break;
default:
addedMaterial = defaultMaterial;
break;
}
this.transform.FindChild("mesh").GetChild(1).renderer.material = addedMaterial;// affectation du material
}
示例11: BlockParserContext
public BlockParserContext(IProblemPipe problemPipe, Fragment returnFragmentType, List<ReturnCondition> returnConditions, IBlacklistManager blacklistManager, BlockParser.InspectCallback inspect)
{
_problemPipe = problemPipe;
_returnFragmentType = returnFragmentType;
_returnConditions = returnConditions;
_blacklistManager = blacklistManager;
_inspect = inspect;
}
示例12: OnAttachFragment
public override void OnAttachFragment(Fragment fragment)
{
base.OnAttachFragment (fragment);
if (fragment is HeaderFragment) {
headerfragment = fragment;
}
}
示例13: OnCreateDialog
public override Dialog OnCreateDialog(Bundle savedInstanceState)
{
mParent = ParentFragment;
return new AlertDialog.Builder(Activity)
.SetMessage(Resource.String.request_permission)
.SetPositiveButton(Android.Resource.String.Ok, new PositiveListener())
.SetNegativeButton(Android.Resource.String.Cancel, new NegativeListener())
.Create();
}
示例14: PreConditionBase
protected PreConditionBase(string symbol, Fragment fragment)
{
ArgumentUtility.CheckNotNullOrEmpty ("symbol", symbol);
ArgumentUtility.CheckNotNull ("fragment", fragment);
_symbol = symbol;
_fragment = fragment;
_problemMetadata = null;
}
示例15: SwitchFragment
private void SwitchFragment(Fragment newContent)
{
// todo change this to use an interface
var baseActivity = Activity as Activity1;
if (baseActivity != null)
{
baseActivity.SwitchContent(newContent);
}
}