2012-12-17 22 views
2

我想編輯一個註釋並在其背景中畫一條紙線。像下面的圖片(你可以看到,無論是縱向和橫向線):如何在Android中使用紙行編輯註釋?

enter image description here

我不知道我該怎麼畫它,我怎麼能重複一次嗎?

+1

如果你只是畫線爲什麼你不能使用畫布? – cjds

+0

如何使用畫布?你能告訴我一個多行圖片的樣本嗎? –

+0

看來這是ImageView中目前缺少的功能。我懷疑你需要創建自己的View類來處理你自己的重複繪圖。 – jsmith

回答

4

這裏是你的問題https://stackoverflow.com/a/10770670/619673

當然你也可以在TextView中實現它(與話題是關於EditText上),但它是完全一樣的操作答案(我想:d)。 要使用它,在你的XML,你必須寫,而不是TextView你的包路徑的自定義Widget類即com.example.notepad.linkededit

enter image description here

例子:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context=".MainActivity" > 

    <com.example.notepadline.LinedEditText 
     android:id="@+id/tv" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:singleLine="false" 
     android:text="AAAA AAAA AAA AAAA AAAA AAA AAAA AAAA AAA AAAA AAAA AAA AAAA AAAA AAA AAAA AAAA AAA" /> 

</RelativeLayout> 

的其他信息是在引用鏈接。

相關問題