1
RelativeLayout overlay = new RelativeLayout(this);
addContentView(overlay, new LayoutParams(LayoutParams.FILL_PARENT, px));
overlay.setBackgroundColor(Color.BLACK);
border = new ImageView(this);
border.setImageResource(R.drawable.featured_bar);
border.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
overlay.addView(border);
的底部我希望得到我邊境的ImageView坐在我的RelativeLayout的底部,programmatically
或課程。安卓:設置一個ImageView的到我的RelativeLayout
基本上,我希望我的裝飾邊框相對於分辨率處於某個位置,並且由於我不知道如何使用x y值進行定位,所以我採用了這種方法。
您可以從這個【答案】幫助[1]。 [1]:http://stackoverflow.com/questions/3053864/how-to-center-layout-to-vertical-in-android-through-java-code – Sandy