imは正方形のimageviewsで表を作成しようとしています(サイズも同じです)。問題は、画像の高さと幅が違うことです。 テーブルは3x3で、私は次のようにしたい: 各セルには画面幅の1/3(多分レイアウトの重み?)と高さ=幅 がある。コード内のxml。 レイアウトの重み=(事前に おかげで、Android square imageview
7
A
答えて
4
とイムnoobのはscaleType属性を試しているので、それを説明してください。あなたがcenterCrop
をしたいと思います。
1
だけでなく、あなたも、各画像を圧迫するscaleType = fitXYを使用することができますImageViewの寸法のimageveiwはきれいな解決策になるかもしれない拡張
1
にこれは私の作品:。
public class Icon extends ImageView {
public Icon(final Context context) {
super(context);
}
public Icon(final Context context, final AttributeSet attrs) {
super(context, attrs);
}
public Icon(final Context context, final AttributeSet attrs,
final int defStyle) {
super(context, attrs, defStyle);
}
@Override
protected void onMeasure(int width, int height) {
super.onMeasure(width, height);
int measuredWidth = getMeasuredWidth();
int measuredHeight = getMeasuredHeight();
if (measuredWidth > measuredHeight) {
setMeasuredDimension(measuredHeight, measuredHeight);
} else {
setMeasuredDimension(measuredWidth, measuredWidth);
}
}
}
とXMLで:
<com.your_package_name.Icon
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:scaleType="centerCrop"
android:src="@drawable/screen" />
関連する問題
- 1. Android Square Register API:ILLEGAL_LOCATION_ID
- 2. android用Square Picture Taker
- 3. Android、ImageView over ImageView
- 4. android imageView
- 5. VideoView crop to square
- 6. Android imageview longpressヒント
- 7. Android ImageViewズームインアイコン
- 8. Android ImageView scalling
- 9. Android ImageView setImageBitmap
- 10. Android ImageView - 16:9
- 11. android imageview onclickリスナー
- 12. AndroidスタジオImageView onDraw
- 13. Android用ウィジェットアニメーションImageView
- 14. Android ImageViewビットマップアップスケールモード
- 15. Android ImageView ScaleType * FIT_TOP *
- 16. Android ImageViewホットスポットマッピング
- 17. Android ImageViewフリッピングアニメーション
- 18. imageview android 2.1
- 19. android - scaling ImageView
- 20. Android ImageView Nearest Neighbor
- 21. Android:カスタムImageView
- 22. Android ImageViewサイクルカラー
- 23. Xamain Android ImageViewズーム
- 24. Android Kotlin ImageViewバインディング
- 25. ImageView onImageChangedListener Android
- 26. android、imageview stretch
- 27. ImageView android abort program
- 28. ImageView in ListView - Android
- 29. Android Squareのグラデーションはありますか?
- 30. Android Square Register API:NO_NETWORK - Square Registerがインターネットに接続できませんでした