2017-05-05 33 views
0

我已經在Android中創建了網格視圖。現在我想使用此自定義佈局將文本放入視圖中。我可以處理所有視圖,但是如何創建圖片中顯示的視圖並在圖像的白色空間和藍色矩形內添加文本?如何在圖像中正確繪製佈局並向其中添加文本

enter image description here

+0

分享您的代碼。 你在xml代碼中嘗試過什麼? –

回答

0

嘗試framelayout。我爲你嘗試了一個。隨意問你是否沒有得到什麼。

<FrameLayout 
       android:layout_width="wrap_content" 
       android:layout_height="match_parent"> 


       <ImageView 
        android:id="@+id/imageViewCircle" 
        android:layout_width="100dp" 
        android:layout_height="100dp" 
        android:layout_marginBottom="3dp" 
        android:layout_marginTop="2dp" 
        android:src="@drawable/mypng" /> 

       <TextView 
        android:id="@+id/textView" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginBottom="20dp" 
        android:gravity="center|center_horizontal" 
        android:text="50" 
        android:textSize="40sp" /> 

       <TextView 
        android:id="@+id/textViewNumeric" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginBottom="5dp" 
        android:gravity="bottom|center_horizontal" 
        android:text="Text" 
        android:textColor="#ffffff" 
        android:textSize="20sp" 
        android:textStyle="bold" /> 
      </FrameLayout> 
+0

你做了我想要的人。但是我需要沒有這些文字的圖像。無論其他用戶如何使用photoshop或inkscape刪除文字。 –

相關問題