По какой-то причине listview не анимируется, а только текстовые просмотры. Я чувствую, что это связано с LayoutInflater, но я не уверен. Здесь я определяю JazzyListView и его анимации:Listview не анимирует
public class RssFragment extends Fragment implements AdapterView.OnItemClickListener {
private ProgressBar progressBar;
private View view;
private View view2;
private JazzyListView listView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setRetainInstance(true);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (view == null) {
view = inflater.inflate(R.layout.fragment_layout,container, false);
progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
listView= (JazzyListView) view.findViewById(R.id.listView);
listView.setOnItemClickListener(this);
startService();
} else {
}
return view;
}
private void startService() {
Intent intent = new Intent(getActivity(), RssService.class);
intent.putExtra(RssService.RECEIVER, resultReceiver);
getActivity().startService(intent);
}
private final ResultReceiver resultReceiver = new ResultReceiver(new Handler()) {
@SuppressWarnings("unchecked")
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
List<RssItem> items = (List<RssItem>) resultData.getSerializable(RssService.ITEMS);
if (items != null) {
RssAdapter adapter = new RssAdapter(getActivity(), items);
listView.setAdapter(adapter);
} else {
Toast.makeText(getActivity(), "The RSS feed is unable to be downloaded at this time",
Toast.LENGTH_LONG).show();
}
progressBar.setVisibility(View.GONE);
listView.setTransitionEffect(JazzyHelper.GROW);
listView.setVisibility(View.VISIBLE);
};
};
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
RssAdapter adapter = (RssAdapter) parent.getAdapter();
RssItem item = (RssItem) adapter.getItem(position);
Intent intent = new Intent(Intent.ACTION_VIEW);
startActivity(intent);
}
}
Вот мой макет:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:baselineAligned="false">
<ImageView
android:layout_width="fill_parent"
android:layout_height="50dp"
android:id="@+id/imageView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#ff090eae" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="KGHS"
android:id="@+id/button"
android:layout_alignBottom="@+id/imageView"
android:layout_centerHorizontal="true" />
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton"
android:layout_alignBottom="@+id/imageView"
android:layout_alignParentRight="true"
/>
<ProgressBar
android:id="@+id/progressBar"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<com.twotoasters.jazzylistview.JazzyListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/listView"
android:divider="#b5b5b5"
app:effect= "grow"
android:dividerHeight="10dp"
android:layout_below="@+id/searchView"
android:layout_marginBottom="60dp"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView2"
android:layout_below="@id/imageView"
android:layout_centerHorizontal="true" />
<SearchView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/searchView"
android:layout_below="@+id/imageView"
/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="60dp"
android:id="@+id/imageView3"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="#ffdedede" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EVENTS"
android:id="@+id/button2"
android:layout_alignBottom="@+id/imageView3"
android:layout_toLeftOf="@+id/button3"
android:layout_toStartOf="@+id/button3"
android:layout_centerHorizontal="true"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="STAFF"
android:id="@+id/button3"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/button"
android:layout_toEndOf="@+id/button" />
</RelativeLayout>
Как я уже говорил перед TextViews (в TextViews в другой XML сами по себе) являются анимировать, но фактического списка нет. Я уже пытался изменить фрагмент на активность, чтобы избавиться от надувного представления/макета. Не уверен, что еще попробовать.
[edit 1] Является ли этот Android SDK анимацией? Это образ из примера приложения библиотеки JazzyListView ... Я был под впечатлением, что jazzylistview также анимировал список, иначе какая точка? ???
Вы уверены, что они показали анимацию в своем примере приложения? –
Да Я уверен, что эффекты анимации не используются для самого списка ListView. – SilentKnight