I have an unusual error with the XML layout file when creating my application when setting the API level to 18. This does not happen with the API level 17. I run the application on Android 4.3 devices, and the error persists on all three devices.
Here's what it looks like:
API 17 (correct):

API 18 (incorrect):

I use the StickyGridHeaders library , and the following is my getHeaderView() method:
@Override public View getHeaderView(int position, View convertView, ViewGroup parent) { RowItem holder; if (convertView == null) { convertView = inflater.inflate(R.layout.seasons_row_header, parent, false); holder = new RowItem(); holder.title = (TextView) convertView.findViewById(R.id.seasonTitle); holder.episodeCount = (TextView) convertView.findViewById(R.id.episodeCount); convertView.setTag(holder); } else { holder = (RowItem) convertView.getTag(); } if (seasons.get(position).equals("00")) { holder.title.setText(R.string.stringSpecials); } else { holder.title.setText(getString(R.string.showSeason) + " " + seasons.get(position)); } int size = seasonEpisodeCount.get(Integer.valueOf(seasons.get(position))); holder.episodeCount.setText(size + " " + getResources().getQuantityString(R.plurals.episodes, size, size)); convertView.setClickable(false); convertView.setFocusable(false); return convertView; }
Here's the XML layout file:
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#80000000" android:padding="@dimen/list_padding" > <TextView android:id="@+id/seasonTitle" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_marginRight="@dimen/list_padding" android:layout_toLeftOf="@+id/episodeCount" android:textAppearance="?android:attr/textAppearanceMedium" android:textIsSelectable="false" android:textStyle="bold" /> <TextView android:id="@+id/episodeCount" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@+id/seasonTitle" android:layout_alignParentRight="true" android:layout_alignTop="@+id/seasonTitle" android:gravity="bottom" android:textAppearance="?android:attr/textAppearanceSmall" android:textIsSelectable="false" /> </RelativeLayout>
Does anyone else know what is going on here? Itβs very strange for me that it works when it targets the API level 17 and does not work when targeting the latest API level (18).
Update:
Here's what the visual layout editor with Android 4.3 looks like as a target:

android android-xml android-4.3-jelly-bean
Michell bak
source share