是一個問答遊戲,答案可以是文字或圖像,我使用吉爾德圖像加載它,但對於一些用戶的圖像無法加載,即使互聯網是好的,圖像質量較差。滑翔圖像有時不加載
我會複製所有的代碼,因爲我不知道是否Gilde問題。
if (AppConstant.arQuestionList.get(questionid).getArAnswer().get(i).getAtype()
.equalsIgnoreCase("image")) {
txtOption = new ImageView(this);
try {
Glide.with(QuestionActivity.this).load(AppConstant.arQuestionList.get(questionid)
.getArAnswer().get(i).getAnswer()).override(60, 60).into((ImageView)
txtOption);
}catch (OutOfMemoryError e){
e.printStackTrace();
}
txtOption.setPadding(5, 5, 5, 5);
} else {
txtOption = new TextView(this);
((TextView) txtOption).setText(AppConstant.arQuestionList.get(questionid)
.getArAnswer().get
(i).getAnswer());
((TextView) txtOption).setTextColor(getResources().getColor(R.color.answer_color));
((TextView) txtOption).setTypeface(tf, Typeface.BOLD);
((TextView) txtOption).setGravity(Gravity.CENTER);
txtOption.setPadding(10, 20, 10, 20);
}
佈局
<LinearLayout
android:id="@+id/answerwrap"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginRight="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_30"
android:orientation="vertical">
</LinearLayout>
我試過了,但還是不行。 –