是圖像的大小。如果是,則表示您可以提到固定大小而不是使用換行內容。
或者,如果它是動態意味着你可以在你的應用程序中使用下面的SquareImageview
public class SquareImageView extends ImageView {
public SquareImageView(Context context) {
super(context);
}
public SquareImageView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public SquareImageView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int width = getMeasuredWidth();
setMeasuredDimension(width, width);
}
}
使用這個類。
然後調用此SquareImageView代替ImageView和layout_height should be match_parent
發佈您的代碼。 –
按鈕不是默認的方形。所以它可能會顯示一些矩形形狀。請嘗試imageView –
請在此處放置您的代碼。 –