Beispiel #1
0
			public int addChild(android.graphics.drawable.Drawable dr)
			{
				int pos = mNumChildren;
				if (pos >= mDrawables.Length)
				{
					growArray(pos, pos + 10);
				}
				dr.setVisible(false, true);
				dr.setCallback(mOwner);
				mDrawables[pos] = dr;
				mNumChildren++;
				mChildrenChangingConfigurations |= dr.getChangingConfigurations();
				mHaveOpacity = false;
				mHaveStateful = false;
				mConstantPadding = null;
				mPaddingChecked = false;
				mComputedConstantSize = false;
				return pos;
			}
Beispiel #2
0
		/// <summary>Set the checkmark to a given Drawable.</summary>
		/// <remarks>
		/// Set the checkmark to a given Drawable. This will be drawn when
		/// <see cref="isChecked()">isChecked()</see>
		/// is true.
		/// </remarks>
		/// <param name="d">The Drawable to use for the checkmark.</param>
		public virtual void setCheckMarkDrawable(android.graphics.drawable.Drawable d)
		{
			if (mCheckMarkDrawable != null)
			{
				mCheckMarkDrawable.setCallback(null);
				unscheduleDrawable(mCheckMarkDrawable);
			}
			mNeedRequestlayout = (d != mCheckMarkDrawable);
			if (d != null)
			{
				d.setCallback(this);
				d.setVisible(getVisibility() == VISIBLE, false);
				d.setState(CHECKED_STATE_SET);
				setMinHeight(d.getIntrinsicHeight());
				mCheckMarkWidth = d.getIntrinsicWidth();
				d.setState(getDrawableState());
			}
			else
			{
				mCheckMarkWidth = 0;
			}
			mCheckMarkDrawable = d;
			// Do padding resolution. This will call setPadding() and do a requestLayout() if needed.
			resolvePadding();
		}
Beispiel #3
0
		/// <summary>
		/// Sets the drawable in an image view, makes sure the view is only visible if there
		/// is a drawable.
		/// </summary>
		/// <remarks>
		/// Sets the drawable in an image view, makes sure the view is only visible if there
		/// is a drawable.
		/// </remarks>
		private void setViewDrawable(android.widget.ImageView v, android.graphics.drawable.Drawable
			 drawable, int nullVisibility)
		{
			// Set the icon even if the drawable is null, since we need to clear any
			// previous icon.
			v.setImageDrawable(drawable);
			if (drawable == null)
			{
				v.setVisibility(nullVisibility);
			}
			else
			{
				v.setVisibility(android.view.View.VISIBLE);
				// This is a hack to get any animated drawables (like a 'working' spinner)
				// to animate. You have to setVisible true on an AnimationDrawable to get
				// it to start animating, but it must first have been false or else the
				// call to setVisible will be ineffective. We need to clear up the story
				// about animated drawables in the future, see http://b/1878430.
				drawable.setVisible(false, false);
				drawable.setVisible(true, false);
			}
		}