-1
我必須在給定圖像中的所有屏幕上的不同點上對齊文本。有沒有人可以幫助我實現這個目標?如何在下圖中對齊所有屏幕的文本視圖
我必須在給定圖像中的所有屏幕上的不同點上對齊文本。有沒有人可以幫助我實現這個目標?如何在下圖中對齊所有屏幕的文本視圖
這是相當難用XML
標記來實現你的UI,但也有Canvas
方法,其輕鬆畫出所有的圖元。
樣品:
private Paint circlePaint;
private Paint linePaint;
private Paint textPaint;
private String[] titles;
private float circleRadius;
@Override protected void onDraw(Canvas canvas) {
float height = getHeight();
float width = getWidth();
float circleX;//set initial X depending on width and height of screen
float circleY;//set initial Y
for (int i = 0; i < titles.length; i++) {
String title = titles[i];
canvas.drawCircle(circleX, circleY, circleRadius, circlePaint);
canvas.drawText(title, circleX + circleRadius, circleY, textPaint);
float nextCircleX;//calculate next X coordinate
float nextCircleY;//calculate next Y coordinate
canvas.drawLine(circleX, circleY, nextCircleX, nextCircleY, circlePaint);
circleX = nextCircleX;
circleY = nextCircleY;
}
}
如何使螺紋直?然後,你可以把你自己的圈子和textViews沿着它。甚至線程可以使用android xml而不是使用圖像? – VipulKumar 2015-02-24 12:03:01
Vipul先生我必須做出相同的外觀我的意思是我不能讓一根線直接然後我必須做的。 – 2015-02-24 12:06:47
每個步驟創建多個圖像並在運行時更改。其中一個解決方案 – virendrao 2015-02-24 12:08:49