2017-02-15 6 views
0

Hey Leute Ich habe dieses Layout, wo es eine Touch-Bild-Ansicht aus dem Internet geladen ist, wenn das Telefon im Hochformat ist alles in Ordnung, aber wenn in der Landschaft der mittlere Teil von das Bild erscheint (ich habe es von Anfang an, um nach oben zu sehen), wie es möglich ist programmatischSo sehen Sie den Inhalt der Bildansicht von oben

hier ist mein Layout, um nach oben:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fitsSystemWindows="true"> 

<RelativeLayout 
    android:id="@+id/rlContent" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:animateLayoutChanges="true" 
    android:background="@drawable/bg"> 

    <include 
     android:id="@+id/top" 
     layout="@layout/top_bar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" /> 

    <include 
     android:id="@+id/title_top" 
     layout="@layout/title_top_bar" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/top" 
     android:layout_margin="10dp" /> 



    <RelativeLayout 
     android:id="@+id/spinnerIndicatorlayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/title_top" 
     android:layout_margin="6dp" 
     android:visibility="gone" 
     android:background="@color/spinner_background" 
     android:gravity="center_horizontal"> 


     <Spinner 
      android:id="@+id/spinnerIndicators" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentStart="true" 
      android:layout_centerInParent="true" 
      android:layout_margin="2dp" 
      android:background="@android:color/transparent" 
      android:gravity="center_horizontal" /> 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentEnd="true" 
      android:layout_centerVertical="true" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 
      android:src="@drawable/arrow" /> 
    </RelativeLayout> 


    <RelativeLayout 
     android:id="@+id/spinnerCountrylayout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/spinnerIndicatorlayout" 
     android:layout_margin="6dp" 
     android:background="@color/spinner_background" 
     android:gravity="center_horizontal"> 


     <Spinner 
      android:id="@+id/spinnerCountries" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentStart="true" 
      android:layout_centerInParent="true" 
      android:layout_margin="2dp" 
      android:background="@android:color/transparent" 
      android:gravity="center_horizontal" /> 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentEnd="true" 
      android:layout_centerVertical="true" 
      android:layout_marginLeft="10dp" 
      android:layout_marginRight="10dp" 
      android:src="@drawable/arrow" /> 
    </RelativeLayout> 


    <ids.undp.classes.TouchImageView 
     android:id="@+id/ivInfographics" 
     android:layout_width="match_parent" 
     android:visibility="invisible" 
     android:layout_height="match_parent" 
     android:layout_below="@+id/spinnerCountrylayout" 
     android:layout_margin="6dp" 

     android:layout_gravity="end" 
     android:adjustViewBounds="true" 
     android:padding="5dp" 
     android:scaleType="centerCrop" 
     android:src="@drawable/defaultbg" /> 

    <ProgressBar 
     android:id="@+id/progress" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:visibility="gone" 
     android:layout_centerInParent="true" /> 


</RelativeLayout> 


<android.support.design.widget.NavigationView 
    android:id="@+id/nav_view" 
    android:layout_width="wrap_content" 
    android:layout_height="match_parent" 
    android:layout_gravity="end" 
    android:background="@drawable/drawer_bg" 
    android:fitsSystemWindows="false"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="@drawable/drawer_bg" 
     android:orientation="vertical"> 
     <ListView 
      android:id="@+id/lst_menu_items" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@android:color/transparent" 
      android:divider="@android:color/transparent" /> 
    </LinearLayout> 
</android.support.design.widget.NavigationView> 

+0

es ist eine Berührung Bildansicht, es kann gescrollt werden, brauche ich nicht eine Bildlaufansicht –

Antwort

0

Try Setscroll verwenden:

public void setScrollPosition(float focusX, float focusY) { 
     setZoom(normalizedScale, focusX, focusY); 
    } 
+0

Wenn ich als Landschaft eingeben, funktioniert es gut, aber wenn ich als protrait und dann in die Landschaft ändern scrollen nicht alle Ich habe sogar versucht, negative Werte als Parameter zu übergeben und es hat nicht funktioniert –

Verwandte Themen