나는 antonyt에 의해 InfiniteViewpager를 사용하여 응용 프로그램을 만들었습니다.안드로이드 조각 Oncreateview Loadanimation
내보기가 생성되었을 때 Imageview
에 애니메이션을 추가하고 싶지만 내 애니메이션이 몇 번이나 항상 작동하는 것은 아닙니다. 여기 코드는 다음과 같습니다
public class ColourFragment extends Fragment {
private int identifier;
private String logo;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Bundle args = getArguments();
identifier = args.getInt("identifier");
logo = args.getString("logo");
}
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View V = inflater.inflate(R.layout.radiologok, container, false);
가 ImageView
내가 애니메이션을 적용 할.
ImageView imageView = (ImageView)V.findViewById(R.id.radiologovalaszto);
ProgressBar progressBar = (ProgressBar) V.findViewById(R.id.progressBar1);
DisplayMetrics displaymetrics = new DisplayMetrics();
getActivity().getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int height = displaymetrics.heightPixels/4 * 3;
int width = displaymetrics.widthPixels/4 * 3;
imageView.setAdjustViewBounds(true);
imageView.getLayoutParams().height = height;
imageView.getLayoutParams().width = width;
웹에서 이미지를 가져 오기 위해 Android 쿼리 라이브러리를로드하십시오.
AQuery aq = new AQuery(getActivity());
AQUtility.setDebug(true);
aq.hardwareAccelerated11();
이미지가 설정됩니다.
:<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false" >
<scale
android:duration="1000"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:toXScale="0.5"
android:toYScale="0.5" />
<scale
android:duration="1000"
android:fromXScale="1"
android:fromYScale="1"
android:pivotX="50%"
android:pivotY="50%"
android:startOffset="1000"
android:toXScale="2"
android:toYScale="2" />
</set>
가 나는 fragmentadapter를 사용하여보기를로드
aq.id(imageView).progress(progressBar).image(logo, true, true, width, 0);
여기에 내가 여기 내 애니메이션 년대 Animation
Animation pulse = AnimationUtils.loadAnimation(getActivity(), R.anim.pulse);
imageView.startAnimation(pulse);
Return V;
}
를 추가 할
을 시작 사용하여 뷰 페이저에서 지금
3을 생성 IC 변수는 당신이 재사용하고 있습니까 보기 ? 어떤 목록보기 안에 있습니까? –
조각에 있습니다. – user2617730
하지만이 조각을 어디에서 보여주고 있습니까? 목록 또는 활동 또는 Viewpager에 저장하고 사용 위치 코드를 게시하십시오 –