0
我有座標來對齊這些圖像,編程方式。現在圖像正在對齊,但圖像從這個cooridinate開始,或者我應該說,座標變成了它的左上角,我想讓它成爲imageview的中心。如何使imageview的座標中心?幫助我,如果有人知道answer.Right現在我這樣做:設置座標爲中心的ImageView android programamtically
ImageView iv = new ImageView(this);
float x_coordinate = 256;
float y_coordinate = 350;
iv.setX(x_coordinate);
iv.setY(y_coordinate);
iv.setImageResource(R.drawable.myimage);
iv.setLayoutParams(new LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
mylayout.addView(iv);
我不是說你問這些選項中的任何一個。我想做一個座標,我的imageview的中心。現在通過上面的書面代碼,座標是我的imageview的左上角。 –
你知道如何做到這一點?我有同樣的問題。 – sboehnke