1
我有使用RelativeLayout顯示內容的片段活動。我正在顯示文字,一切正常。如何在片段上使用onDraw?
現在我想添加一些圖形信息,我有問題。 Fragment中沒有onDraw()方法。
有沒有一種方法可以使用RelativeLayout來顯示文本信息並同時在Fragment上繪製?
謝謝。
更新:
我使用這個代碼:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
mFragmentView = inflater.inflate(R.layout.fragment_stat, container, false);
return mFragmentView;
}
據我瞭解,我將不得不重寫(或改變)由Inflater.inflate創建的視圖()方法。我怎樣才能做到這一點?
我認爲構建自定義相對佈局和重寫onDraw是一種方法。 – subhash
[在Android中的碎片中繪圖]可能的重複(http://stackoverflow.com/questions/23280685/drawing-in-a-fragment-in-android) – user2413972