0

를 볼되지 않습니다,이 같은 내장 그 안에 3 ImageViews,와 ViewFlipper이 이 코드를 사용하여 라이브러리 (com.github.bumptech.glide:glide:3.7.0') :ViewFlipper 이미지가 내 안드로이드 응용 프로그램의 활동 중 하나에

flipper = (ViewFlipper) findViewById(R.id.flipper); 
imageFlipper1 = (ImageView) findViewById(R.id.imageFlipper1); 
imageFlipper2 = (ImageView) findViewById(R.id.imageFlipper2); 
imageFlipper3 = (ImageView) findViewById(R.id.imageFlipper3); 

// Load images 
Glide.with(getApplicationContext()).load("url1").into(imageFlipper1); 
Glide.with(getApplicationContext()).load("url2").into(imageFlipper2); 
Glide.with(getApplicationContext()).load("url3").into(imageFlipper3); 

// Setup the ViewFlipper 
flipper.setAutoStart(true); 
flipper.setFlipInterval(2000); 
flipper.startFlipping(); 

URL이 유효하며, 그래서 독립적 인 이미지 뷰에 이미지를로드하려고 할 때, 나는 화면의 이미지를 보았다. 기본적으로 아무 것도 오류를 포함해야하지만, 어떤 이유로 애플 리케이션을 실행할 때 화면에 이미지가 보이지 않습니다.

도와 주실 수 있습니까?

답변

0

마침내 해결책을 찾았습니다. 나는 폭과 match_parentwrap_contentViewFlipper의 높이 및 match_parent에 내부 RelativeLayout의의 폭과 높이를 변경, 지금은 내 활동에 대한 이미지를 볼 수 있습니다

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:context="com.example.app.MainActivity" 
    tools:showIn="@layout/app_bar_main" 
    android:layout_margin="8dp" 
    android:background="#fff"> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 

     <ViewFlipper 
      android:id="@+id/flipper" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content"> 

      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_gravity="center" 
       android:gravity="center"> 

       <ImageView 
        android:id="@+id/flipper1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:adjustViewBounds="true" 
        android:foregroundGravity="center" 
        android:scaleType="fitCenter"/> 

      </RelativeLayout> 

      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_gravity="center" 
       android:gravity="center"> 

       <ImageView 
        android:id="@+id/flipper2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:adjustViewBounds="true" 
        android:foregroundGravity="center" 
        android:scaleType="fitCenter"/> 

      </RelativeLayout> 

      <RelativeLayout 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:layout_gravity="center" 
       android:gravity="center"> 

       <ImageView 
        android:id="@+id/flipper3" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_gravity="center" 
        android:adjustViewBounds="true" 
        android:foregroundGravity="center" 
        android:scaleType="fitCenter"/> 

      </RelativeLayout> 

     </ViewFlipper> 

    </LinearLayout> 

</ScrollView>