我决定有一天运行相同的应用程序,并发现图像正在获得这些奇怪的黑色渐变背景而不是透明度。似乎图像没有正确渲染。
图像是透明的。并且似乎图像的背景正在被此错误所取代。
有人知道怎么修这个东西吗?
这是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);
}
});
}
}
谢谢!