zoomen und co.

  • Antworten:0
Leo K.
  • Forum-Beiträge: 56

06.03.2011, 17:41:14 via Website

Hi,
ich komme irgendwie nicht weiter, für meine App (Impossible Quiz) möchte ich ein Bilder-Fehlersuchen level machen, aber ich kriegs nicht hin! Ich hab ein bild in einzelteile zerschnitten, damit ich auf einzelne zeile ein onTouch event ausführen kann, jetzt hab ich sie in meiner xml mit LinearLayouts so ausgerichte, das sie wieder das bild ergeben, aber wie kann ich das mit dem zoomen realisieren, hab nirgens ne erklärung für ZoomControls gefunden, also hab ich selber was mit 2 buttons mit + und - versucht:
1) Die größe der einzelnen teile verdoppeln bzw, halbieren wenn ein button gedrückt wird, hat net klappt, irgendwie spinnt das schon am anfang wenn ich die standart werte mache, z.b. soll die ImageView "SuchLinks" so groß sein wie "SuchFsonne" + "SuchUSonne", macht er aber net -.- :
1Display display = getWindowManager().getDefaultDisplay();
2 heightPX = display.getHeight();
3 final Handler handler = new Handler();
4 final int hoehe = Integer.valueOf(heightPX*4/5);
5 final int breite = Integer.valueOf(hoehe*667/300);
6
7 lp = new LinearLayout.LayoutParams(breite*340/667,hoehe);
8 SuchLinks.setLayoutParams(lp);
9 lp = new LinearLayout.LayoutParams(breite*32/667,hoehe*268/300);
10 SuchUsonne.setLayoutParams(lp);
11 lp = new LinearLayout.LayoutParams(breite*32/667,hoehe*32/300);
12 SuchFsonne.setLayoutParams(lp);
13und so weiter

2)Alle einzelnen ImageViews auf fillparent und die größe des layouts "SucheLay" verändern geht auch nicht, weil das bild dann nicht mehr richtig zusammen gesetzt wird, alles verzogen usw.!:
1<ScrollView android:id="@+id/SucheScrollView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5px" android:layout_marginTop="5px" android:layout_marginRight="5px" android:layout_marginBottom="5px" android:scrollbars="none">
2 <HorizontalScrollView android:id="@+id/SucheHorizontalScrollView01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scrollbars="none">
3 <LinearLayout android:id="@+id/SucheLay" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal">
4
5 <ImageView android:id="@+id/SuchLinks" android:background="@drawable/suchelinks" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
6
7 <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical">
8 <ImageView android:id="@+id/SuchFsonne" android:background="@drawable/suchefsonne" android:layout_width="fill_parent" android:layout_height="fill_parent"></ImageView>
9 <ImageView android:id="@+id/SuchUsonne" android:background="@drawable/sucheusonne" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
10 </LinearLayout>
11
12 <ImageView android:id="@+id/SuchLmensch" android:background="@drawable/suchelmensch" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
13
14 <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical">
15 <ImageView android:id="@+id/SuchOmensch" android:background="@drawable/sucheomensch" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
16 <ImageView android:id="@+id/SuchFmensch" android:background="@drawable/suchefmensch" android:layout_width="fill_parent" android:layout_height="fill_parent"></ImageView>
17 <ImageView android:id="@+id/SuchUmensch" android:background="@drawable/sucheumensch" android:layout_width="fill_parent" android:layout_height="fill_parent"></ImageView>
18 </LinearLayout>
19
20 <ImageView android:id="@+id/SuchLball" android:background="@drawable/suchelball" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
21
22 <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical">
23 <ImageView android:id="@+id/SuchOball" android:background="@drawable/sucheoball" android:layout_width="fill_parent" android:layout_height="fill_parent"></ImageView>
24 <ImageView android:id="@+id/SuchFball" android:background="@drawable/suchefball" android:layout_width="fill_parent" android:layout_height="fill_parent"></ImageView>
25 </LinearLayout>
26
27 <ImageView android:id="@+id/SuchLschild" android:background="@drawable/suchelschild" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
28
29 <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical">
30 <ImageView android:id="@+id/SuchOschild" android:background="@drawable/sucheoschild" android:layout_width="fill_parent" android:layout_height="fill_parent"></ImageView>
31 <ImageView android:id="@+id/SuchFschild" android:background="@drawable/suchefschild" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
32 <ImageView android:id="@+id/SuchUschild" android:background="@drawable/sucheuschild" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
33 </LinearLayout>
34
35 <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical">
36 <ImageView android:id="@+id/SuchOlampe" android:background="@drawable/sucheolampe" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
37 <ImageView android:id="@+id/SuchFlampe" android:background="@drawable/sucheflampe" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
38 <ImageView android:id="@+id/SuchUlampe" android:background="@drawable/sucheulampe" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
39 </LinearLayout>
40
41 <ImageView android:id="@+id/SuchRlampe" android:background="@drawable/sucherlampe" android:layout_height="fill_parent" android:layout_width="fill_parent"></ImageView>
42 </LinearLayout>
43 </HorizontalScrollView>
44</ScrollView>

3) Hab was mit alle weight = 1 versucht, aber das gleiche ergebnis wie bei 2.

Also weiß wer zu helfen, am liebsten hätt ich ja gewusst wie man die Zoom Controls benutzt und dann ne 2. Ebene bei dem Bild macht wo mann dann Touch-Events setzen kann damit ich das bild net zerschneiden muss, aber ich hab soweit nicht wirklich was darüber gefunden...

AJa und CO:
Ich krieg manchmal im market 1 Sterne bewertungen weil bei meinem buttons kein text sein soll, und keiner schreibt mir bei welchem Gerät oder mehr infos, also tu ich mich schwer das problem zu beheben, weil es bei all meinen freunden problemlos läuft! Vil. hats ja was mit der größe der schrift zu tun:
1Display display = getWindowManager().getDefaultDisplay();
2 final int width_px = display.getWidth();
3 final int height_px = display.getHeight();
4 height = (height_px/2-20);
5 but_Answ1.setTextSize(TypedValue.COMPLEX_UNIT_PX, height/3);
6 but_Answ2.setTextSize(TypedValue.COMPLEX_UNIT_PX, height/3);
7 but_Answ3.setTextSize(TypedValue.COMPLEX_UNIT_PX, height/3);
8 but_Answ4.setTextSize(TypedValue.COMPLEX_UNIT_PX, height/3);
wie gesagt, bis jetzt klappt das überall wo ichs gesehen hab, und bei 90% der downloader wie es scheint auch, aber irgendwie nicht bei allen -.-

niemand MUSS auf meine Fragen antworten =D
lg Leo

Antworten