Google uses AI technology to translate content into your preferred language. AI translations can contain errors.
Class ImageCropStyle
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ImageCropStyle
画像コンポーネントに適用できるクロップ スタイルを表すクラス。画像のサイズを設定したり、サイズを変更したりすることはできませんが、画像を切り抜くことはできます。
詳細なドキュメント
setAspectRatio(ratio)
切り抜きタイプが RECTANGLE_CUSTOM の場合に使用するアスペクト比を設定します。比率は正の値である必要があります。
パラメータ
| 名前 | タイプ | 説明 |
ratio | Number | 適用する還元率。 |
戻る
ImageCropStyle - チェーン用のこのオブジェクト。
例外
Error - 入力が負またはゼロの場合。
setImageCropType(type)
画像の切り抜きタイプを設定します。デフォルトは SQUARE です。
パラメータ
戻る
ImageCropStyle - チェーン用のこのオブジェクト。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2026-04-13 UTC。
[null,null,["最終更新日 2026-04-13 UTC。"],[],["The `ImageCropStyle` class allows users to crop images without resizing them. Key actions include setting the image crop type using `setImageCropType`, which defaults to SQUARE. For a `RECTANGLE_CUSTOM` crop type, you can set the aspect ratio via `setAspectRatio`, which requires a positive numeric value. Both methods return the `ImageCropStyle` object, enabling method chaining. `setAspectRatio` throws an error if the ratio is zero or negative.\n"]]