2015-10-07 311 views
0

所以我現在有這樣的:如何將圖像添加到視圖

final class Question { 

private final String questionType; 
private final String question; 
private final ArrayList<String> answers; 

private Question(final String questionType, final String question, final ArrayList<String> answers) { 
    this.questionType = questionType; 
    this.question = question; 
    this.answers = answers; 
} 

/** 
* Takes a comma separated String of the question type, the question, and the answers, and returns a {@link Question} representation of them. 
* 
* @param input The input String made up of the type of question, the question itself, and the answers (comma separated). 
* @return a {@link Question} representation of the input string. 
* @throws IllegalArgumentException 
*/ 
public static Question parse(final String input) throws IllegalArgumentException { 

    final String[] questionComponents; 
    final String questionType; 
    final String question; 
    final ArrayList<String> answers = new ArrayList<String>(); 

哪些訂閱關閉此:

娛樂,阿德里安·布羅迪贏得了奧斯卡最佳男演員的電影時,鋼琴家, The Village,King Kong,Dummy 娛樂,亞歷克·吉尼斯贏得了最佳男主角奧斯卡的哪部電影?,桂河大橋,羅馬帝國的秋天,馬的嘴巴,薰衣草山Mob 娛樂,亞歷克吉尼斯爵士贏得了哪一部電影的最佳男主角奧斯卡獎?,桂河大橋,金錢運行,最後一個假期,提高泰坦尼克號 娛樂,藝術卡尼贏得了最佳男主角奧斯卡爲哪部電影?,哈利和託頓,Roadie,晚秀,拉尼甘的拉比 娛樂,布羅德里剋剋勞福德贏得了最佳男主角奧斯卡的電影?,所有國王的男人,黑天使,出生昨天,你生活的時間

即時通訊只是不知道如何將圖像添加到文本列表我將只有一個額外的行與@ drawable /圖像,我將如何impliment進入類?

回答

0

如果您正在使用圖像URL然後把String,或者如果您使用的圖像繪製使用int (R.drawable.image)

0

聽起來像需要其自己的變量,沒有辦法添加圖像轉換爲字符串數組。您可以通過您的解析方法使用R.drawable.image_id來傳遞您希望使用的圖像ID。

+0

那麼我會怎麼稱呼這些圖像呢?像說有20?我會不會只放在文本文件@ drawable/image1,並使其成爲imageview的圖像源? –