當前位置: 首頁>>代碼示例>>Java>>正文


Java Orientation類代碼示例

本文整理匯總了Java中android.graphics.drawable.GradientDrawable.Orientation的典型用法代碼示例。如果您正苦於以下問題:Java Orientation類的具體用法?Java Orientation怎麽用?Java Orientation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Orientation類屬於android.graphics.drawable.GradientDrawable包,在下文中一共展示了Orientation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setVerValSlider

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
/**
 * Create a linear gradient shader to show variations in value.
 */
private void setVerValSlider() {
	float[] hsv = new float[3];
	hsv[0] = mHSV[0];
	hsv[1] = mHSV[1];
	hsv[2] = 1;
	int col = Color.HSVToColor(hsv);

	int colors[] = new int[2];
	colors[0] = col;
	colors[1] = 0xFF000000;
	GradientDrawable gradDraw = new GradientDrawable(Orientation.TOP_BOTTOM, colors);
	gradDraw.setDither(true);
	gradDraw.setLevel(10000);
	gradDraw.setBounds(0, 0, mSliderThicknessPx, mPaletteDimPx);
	gradDraw.draw(mVerSliderCv);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:20,代碼來源:UberColorPickerDialog.java

示例2: createColoredDrawable

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
/**
 * Creates a new drawable (implementation of the Drawable object may vary depending on the OS version).
 * The result Drawable will be colored with the given color, and clipped to match the given bounds.
 * Note that the drawable's alpha is set to 0 when argument color is {@link Color#TRANSPARENT}.
 *
 * @param color  Integer color used to color the output drawable
 * @param bounds Four-dimensional vector representing drawable bounds
 * @return Colored and clipped drawable object
 */
@NonNull
public static Drawable createColoredDrawable(@ColorInt final int color, @Nullable final Rect bounds) {
    // create the drawable depending on the OS (pre-Honeycomb couldn't use color drawables inside state lists)
    Drawable drawable;
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB || bounds != null) {
        drawable = new GradientDrawable(Orientation.BOTTOM_TOP, new int[] { color, color }).mutate();
    } else {
        drawable = new ColorDrawable(color).mutate();
    }

    // set the alpha value
    if (color == Color.TRANSPARENT) {
        drawable.setAlpha(0);
    }

    // update bounds
    if (bounds != null) {
        drawable.setBounds(bounds);
    }
    return drawable;
}
 
開發者ID:milosmns,項目名稱:silly-android,代碼行數:31,代碼來源:Coloring.java

示例3: makeHeaderView

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
protected View makeHeaderView(int headerHeight, float headerRadius) {
	LayoutParams headerParams = new LayoutParams(LayoutParams.FILL_PARENT, headerHeight);
	
	TextView header = new TextView(getContext());
	
	if(colors != null) {
		GradientDrawable headerBG = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{colors.getColor(Colors.AUTH_PANEL_BOTTOM), colors.getColor(Colors.AUTH_PANEL_TOP)});
		headerBG.setCornerRadii(new float[]{headerRadius, headerRadius, headerRadius, headerRadius, 0.0f, 0.0f, 0.0f, 0.0f});

		CompatUtils.setBackgroundDrawable(header, headerBG);
	}

	if(localizationService != null) {
		header.setText(localizationService.getString(I18NConstants.SHARE_HEADER));
	}

	header.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	header.setTextColor(Color.WHITE);
	header.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
	header.setLayoutParams(headerParams);
	
	return header;
}
 
開發者ID:dylanmaryk,項目名稱:InsanityRadio-Android,代碼行數:24,代碼來源:SharePanelView.java

示例4: makeImage

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
@Override
protected ImageView makeImage() {
	defaultProfilePicture = drawables.getDrawable(Socialize.DEFAULT_USER_ICON);
	profilePicture = new ImageView(getContext());
	
	int imageSize = displayUtils.getDIP(64);
	int imagePadding = displayUtils.getDIP(4);
	
	LayoutParams imageLayout = new LinearLayout.LayoutParams(imageSize,imageSize);
	
	GradientDrawable imageBG = new GradientDrawable(Orientation.BOTTOM_TOP, new int[] {Color.WHITE, Color.WHITE});
	imageBG.setStroke(2, Color.BLACK);
	imageBG.setAlpha(64);
	
	profilePicture.setLayoutParams(imageLayout);
	profilePicture.setPadding(imagePadding, imagePadding, imagePadding, imagePadding);

	CompatUtils.setBackgroundDrawable(profilePicture, imageBG);

	profilePicture.setScaleType(ScaleType.CENTER_CROP);
	
	return profilePicture;
}
 
開發者ID:dylanmaryk,項目名稱:InsanityRadio-Android,代碼行數:24,代碼來源:ProfilePictureEditView.java

示例5: makeHeaderView

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
protected View makeHeaderView(int headerHeight, float headerRadius) {
	LayoutParams headerParams = new LayoutParams(LayoutParams.FILL_PARENT, headerHeight);
	
	TextView header = new TextView(getContext());
	
	if(colors != null) {
		GradientDrawable headerBG = new GradientDrawable(Orientation.BOTTOM_TOP, new int[]{colors.getColor(Colors.AUTH_PANEL_BOTTOM), colors.getColor(Colors.AUTH_PANEL_TOP)});
		headerBG.setCornerRadii(new float[]{headerRadius, headerRadius, headerRadius, headerRadius, 0.0f, 0.0f, 0.0f, 0.0f});

		CompatUtils.setBackgroundDrawable(header, headerBG);
	}

       if(localizationService != null) {
           header.setText(localizationService.getString(I18NConstants.AUTH_HEADER));
       }

	header.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
	header.setTextColor(Color.WHITE);
	header.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
	header.setLayoutParams(headerParams);
	
	return header;
}
 
開發者ID:dylanmaryk,項目名稱:InsanityRadio-Android,代碼行數:24,代碼來源:AuthPanelView.java

示例6: initResourcesIfNecessary

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(R.drawable.wheel_val);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(R.drawable.wheel_bg);
}
 
開發者ID:LegendKe,項目名稱:MyTravelingDiary,代碼行數:19,代碼來源:WheelView.java

示例7: initResourcesIfNecessary

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
	if (centerDrawable == null) {
		centerDrawable = getContext().getResources().getDrawable(wheelForeground);
	}

	if (topShadow == null) {
		topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
	}

	if (bottomShadow == null) {
		bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
	}

	setBackgroundResource(wheelBackground);
}
 
開發者ID:dscn,項目名稱:ktball,代碼行數:19,代碼來源:WheelView.java

示例8: SearchView

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
public SearchView(Context context, StringBuilder queryText) {
    super(context);

    mContext = context;
    mQueryText = queryText;

    mPaint = new Paint();
    mPaint.setAntiAlias(true);

    final SurfaceHolder holder = getHolder();
    holder.setFormat(PixelFormat.TRANSLUCENT);
    holder.addCallback(mSurfaceCallback);

    final Resources res = context.getResources();

    int mExtremeRadius = 128;

    // Gradient colors.
    final int gradientInnerColor = res.getColor(R.color.search_overlay);
    final int gradientOuterColor = res.getColor(R.color.search_overlay);
    final int[] colors = new int[] {gradientInnerColor, gradientOuterColor};
    mGradientBackground =
            new GradientDrawable(Orientation.TOP_BOTTOM, colors);
    mGradientBackground.setGradientType(GradientDrawable.LINEAR_GRADIENT);
}
 
開發者ID:google,項目名稱:brailleback,代碼行數:26,代碼來源:SearchView.java

示例9: initResourcesIfNecessary

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
    if (centerDrawable == null) {
        centerDrawable = getContext().getResources().getDrawable(wheelForeground);
    }

    if (topShadow == null) {
        topShadow = new GradientDrawable(Orientation.TOP_BOTTOM, SHADOWS_COLORS);
    }

    if (bottomShadow == null) {
        bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP, SHADOWS_COLORS);
    }

    setBackgroundResource(wheelBackground);
}
 
開發者ID:absentm,項目名稱:myapplication,代碼行數:19,代碼來源:WheelView.java

示例10: initResourcesIfNecessary

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
	if (centerDrawable == null) {
		centerDrawable = getContext().getResources().getDrawable(
				R.drawable.two_line);
	}

	if (topShadow == null) {
		topShadow = new GradientDrawable(Orientation.TOP_BOTTOM,
				SHADOWS_COLORS);
	}

	if (bottomShadow == null) {
		bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP,
				SHADOWS_COLORS);
	}

	setBackgroundResource(R.drawable.white);
}
 
開發者ID:BigAppOS,項目名稱:BigApp_Discuz_Android,代碼行數:22,代碼來源:WheelView.java

示例11: initResourcesIfNecessary

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
/**
 * Initializes resources
 */
private void initResourcesIfNecessary() {
	if (centerDrawable == null) {
		centerDrawable = getContext().getResources().getDrawable(
				R.drawable.wheel_val);
	}

	if (topShadow == null) {
		topShadow = new GradientDrawable(Orientation.TOP_BOTTOM,
				SHADOWS_COLORS);
	}

	if (bottomShadow == null) {
		bottomShadow = new GradientDrawable(Orientation.BOTTOM_TOP,
				SHADOWS_COLORS);
	}

	setBackgroundResource(R.drawable.wheel_bg);
}
 
開發者ID:yndongyong,項目名稱:fast-dev-library,代碼行數:22,代碼來源:WheelView.java

示例12: setVerValSlider

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
/**
 * Create a linear gradient shader to show variations in value.
 */
private void setVerValSlider() {
	float[] hsv = new float[3];
	hsv[0] = mHSV[0];
	hsv[1] = mHSV[1];
	hsv[2] = 1;
	int col = Color.HSVToColor(hsv);

	int colors[] = new int[2];
	colors[0] = col;
	colors[1] = 0xFF000000;
	GradientDrawable gradDraw = new GradientDrawable(Orientation.TOP_BOTTOM, colors);
	gradDraw.setDither(true);
	gradDraw.setLevel(10000);
	gradDraw.setBounds(0, 0, SLIDER_THICKNESS, PALETTE_DIM);
	gradDraw.draw(mVerSliderCv);
}
 
開發者ID:dragonlinux,項目名稱:connectbot,代碼行數:20,代碼來源:UberColorPickerDialog.java

示例13: init

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
/**
 * Inits the.
 */
private void init() {
	l = new char[] {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K',
			'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
			'X', 'Y', 'Z', '#' };
	paint = new Paint();
	paint.setColor(Color.parseColor("#949494"));
	paint.setTypeface(Typeface.DEFAULT_BOLD);
	paint.setTextSize(22);
	paint.setAntiAlias(true);
	paint.setTextAlign(Paint.Align.CENTER);
	
	gradientDrawable = new GradientDrawable(Orientation.BOTTOM_TOP, new int []{0x99B0B0B0,0x99B0B0B0});
	gradientDrawable.setCornerRadius(30);

}
 
開發者ID:bangqu,項目名稱:eshow-android,代碼行數:19,代碼來源:AbLetterFilterListView.java

示例14: ActionBarBackgroundUpdater

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
public ActionBarBackgroundUpdater(Window paramWindow, PlayHeaderListLayout paramPlayHeaderListLayout)
{
  this.mWindow = paramWindow;
  this.mHeaderListLayout = paramPlayHeaderListLayout;
  Resources localResources = paramPlayHeaderListLayout.getResources();
  this.mTransparentBackground = new ColorDrawable(0);
  final int i = FinskySearchToolbar.getToolbarHeight(this.mHeaderListLayout.getContext());
  int[] arrayOfInt = new int[2];
  arrayOfInt[0] = this.mHeaderListLayout.getResources().getColor(2131689730);
  arrayOfInt[1] = 0;
  this.mProtectionBackground = new GradientDrawable(GradientDrawable.Orientation.TOP_BOTTOM, arrayOfInt)
  {
    protected final void onBoundsChange(Rect paramAnonymousRect)
    {
      if (paramAnonymousRect.bottom - paramAnonymousRect.top > i) {
        paramAnonymousRect.bottom = (paramAnonymousRect.top + i);
      }
      super.onBoundsChange(paramAnonymousRect);
    }
  };
  this.mBaseBackground = this.mProtectionBackground;
  this.mSearchStatusBarColor = localResources.getColor(2131689676);
  this.mWasHeaderListFloating = this.mHeaderListLayout.isHeaderFloating();
  this.mWasStatusBarUnderlayProtectingControls = this.mHeaderListLayout.isStatusBarUnderlayProtectingControls();
  updateActionBar();
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:27,代碼來源:ActionBarBackgroundUpdater.java

示例15: setLastLineOverdrawColor

import android.graphics.drawable.GradientDrawable.Orientation; //導入依賴的package包/類
public void setLastLineOverdrawColor(int paramInt)
{
  if (!this.mToDrawOverLastLineIfNecessary)
  {
    this.mLastLineOverdrawPaint = new Paint();
    this.mLastLineOverdrawPaint.setStyle(Paint.Style.FILL_AND_STROKE);
    Resources localResources = getResources();
    this.mLastLineFadeOutSize = localResources.getDimensionPixelSize(R.dimen.play_text_view_fadeout);
    this.mLastLineFadeOutHintMargin = localResources.getDimensionPixelSize(R.dimen.play_text_view_fadeout_hint_margin);
  }
  this.mLastLineOverdrawPaint.setColor(paramInt);
  GradientDrawable.Orientation localOrientation = GradientDrawable.Orientation.LEFT_RIGHT;
  int[] arrayOfInt = new int[2];
  arrayOfInt[0] = (0xFFFFFF & paramInt);
  arrayOfInt[1] = paramInt;
  this.mLastLineFadeOutDrawable = new GradientDrawable(localOrientation, arrayOfInt);
  this.mToDrawOverLastLineIfNecessary = true;
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:19,代碼來源:PlayTextView.java


注:本文中的android.graphics.drawable.GradientDrawable.Orientation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。