我決定在某一天運行同一個確切的應用程序,並認爲圖像越來越奇怪的黑色漸變背景而不是透明度。看起來像圖像沒有被正確渲染。Android應用程序中的圖像越來越奇怪的背景漸變
圖像是透明的。而且似乎圖像的背景正在被這個錯誤所取代。
任何人都知道如何解決這個問題?
下面是XML佈局文件:
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/padding_small"
android:stretchColumns="2" >
<TableRow
android:id="@+id/tableRow1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/padding_small" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center|fill_horizontal"
android:padding="@dimen/padding_medium"
android:text="@string/VincentiDesc2"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="italic"
android:layout_weight="1"
android:ellipsize="none"
android:maxLines="100"
android:scrollHorizontally="false" />
</TableRow>
<TableRow
android:id="@+id/tableRow2y"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/yes_button"
android:layout_width="80dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="@drawable/abs__btn_cab_done_default_holo_light"
android:scaleType="fitCenter"
android:src="@drawable/yes_button" />
</TableRow>
<TableRow
android:id="@+id/tableRow2"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/no_button"
android:layout_width="80dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="@drawable/abs__btn_cab_done_default_holo_light"
android:scaleType="fitCenter"
android:src="@drawable/no_button" />
</TableRow>
<TableRow
android:id="@+id/tableRow3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/padding_small" >
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center|fill_horizontal"
android:padding="@dimen/padding_medium"
android:text="@string/VincentiNoteDesc2"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="normal"
android:layout_weight="1"
android:ellipsize="none"
android:maxLines="100"
android:scrollHorizontally="false" />
</TableRow>
</TableLayout>
和片段
public class Description2Fragment extends SherlockFragment {
OnNextPressedListener mListener;
View nobutton;
View yesbutton;
//update Personal Info variables
private long PIid;
public PersonalInfo newPI;
private PersonalInfoDataSource datasource;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.intro_description2, container, false);
}
@Override
public void onStart() {
super.onStart();
nobutton = getActivity().findViewById(R.id.no_button);
nobutton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
datasource = new PersonalInfoDataSource(getActivity());
datasource.open();
List<PersonalInfo> l = datasource.getAllPersonalInfos();
if(l==null) {
newPI = datasource.createPersonalInfo("", "", "", "", "", false,"","","","");
} else if (l.size()==0) {
newPI = datasource.createPersonalInfo("", "", "", "", "", false,"","","","");
} else {
newPI = l.get(0);
}
datasource.updatePersonalInfoStat(newPI.getId(), false);
datasource.close();
mListener.nextPressed(1);
}
});
yesbutton = getActivity().findViewById(R.id.yes_button);
yesbutton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//update Stat to 1 = TRUE
datasource = new PersonalInfoDataSource(getActivity());
datasource.open();
List<PersonalInfo> l = datasource.getAllPersonalInfos();
if(l==null) {
newPI = datasource.createPersonalInfo("", "", "", "", "", false,"","","","");
} else if (l.size()==0) {
newPI = datasource.createPersonalInfo("", "", "", "", "", false,"","","","");
} else {
newPI = l.get(0);
}
datasource.updatePersonalInfoStat(newPI.getId(), true);
datasource.close();
mListener.nextPressed(1);
}
});
}
}
謝謝!
你可以請把一些代碼或XML佈局文件相同? – NIKHIL
在編輯中放置xml佈局文件和片段!對於那個很抱歉!感謝您的幫助 – ChrisBorg