FireZenk 
|
Publicado: Mie Sep 23, 2009 4:25 pm Título del mensaje: Scroll Horizontal y vertical, ¿como? |
|
|
Pues eso, quiero ver una imagen muy grande en mi programa y no se como puedo hacer para conseguir los 2 tipos de scroll a la vez, solo consigo el vertical.
Y otra cosa, como se hace para ponerle zoom a una imagen?
Un saludo y gracias. |
|
FireZenk 
|
|
nataliapc 
|
Publicado: Mie Sep 23, 2009 5:33 pm Título del mensaje: |
|
|
| Gracias por el aporte FireZenk ^^ |
|
FireZenk 
|
Publicado: Mie Sep 23, 2009 5:42 pm Título del mensaje: |
|
|
| nataliapc escribió: |
| Gracias por el aporte FireZenk ^^ |
De nada, hay que ayudarse entre todos!
P.D. beep beep jaja |
|
JaVaK 
|
Publicado: Mie Sep 23, 2009 5:45 pm Título del mensaje: |
|
|
| Gracias FireZenk por el aporte, ya lo he metido a la biblioteca. |
|
nataliapc 
|
Publicado: Mie Sep 23, 2009 5:46 pm Título del mensaje: |
|
|
| xDDDD |
|
FireZenk 
|
Publicado: Mie Sep 23, 2009 5:47 pm Título del mensaje: |
|
|
| JaVaK escribió: |
| Gracias FireZenk por el aporte, ya lo he metido a la biblioteca. |
Ojoas, ahora si me siento alagado xDD |
|
kronos 
|
Publicado: Mie Ene 13, 2010 5:55 pm Título del mensaje: |
|
|
Implemente el código pero al moverme en forma paralela no tenia el resultado esperado, ya que solo te puedes mover hacia los cuatro costados.
Implemente una solución que permite el desplazamiento pero sin mostrar scrollbars.
XML: (design.xml)
| Código : | <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <FrameLayout android:layout_width="90px" android:layout_height="90px"> <RelativeLayout android:id="@+id/container" android:layout_width="fill_parent" android:layout_height="fill_parent"> </RelativeLayout> </FrameLayout> </FrameLayout>
|
| Código : | public class Example extends Activity { private RelativeLayout container; private int currentX; private int currentY;
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.design);
container = (RelativeLayout)findViewById(R.id.container);
int top = 0; int left = 0;
ImageView image1 = ... RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(left, top, 0, 0); container.addView(image1, layoutParams);
ImageView image2 = ... left+= 100; RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(left, top, 0, 0); container.addView(image2, layoutParams);
ImageView image3 = ... left= 0; top+= 100; RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(left, top, 0, 0); container.addView(image3, layoutParams);
ImageView image4 = ... left+= 100; RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); layoutParams.setMargins(left, top, 0, 0); container.addView(image4, layoutParams); }
@Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: { currentX = (int) event.getRawX(); currentY = (int) event.getRawY(); break; }
case MotionEvent.ACTION_MOVE: { int x2 = (int) event.getRawX(); int y2 = (int) event.getRawY(); container.scrollBy(currentX - x2 , currentY - y2); currentX = x2; currentY = y2; break; } case MotionEvent.ACTION_UP: { break; } } return true; } }
|
|
|
JaVaK 
|
Publicado: Jue Ene 14, 2010 1:48 am Título del mensaje: |
|
|
| Lo que preguntas es que no sabes cómo mostrar los scrollsbars ¿no? |
|
kronos 
|
Publicado: Vie Ene 15, 2010 9:21 pm Título del mensaje: |
|
|
En realidad para la aplicacion que estoy haciendo no necesito mostrar scrolbars, solo generar el efecto.
Ahora estoy controlando los topes pero esta funcionando sin problemas. |
|
zash 
|
Publicado: Mie Feb 03, 2010 7:01 pm Título del mensaje: |
|
|
Hola, he utilizado el codigo de #2, y me aparece el scroll horizontal pero no el vertical, que aparece cuando se cargan los datos y luego desaparece y ya no podemos hacer scroll y acceder a todos los resultados. Creo que lo he hecho como pone aqui y en mas webs, pero no se por que no tira.
| Código : | <?xml version="1.0" encoding="utf-8"?> <ScrollView android:id="@+id/ScrollView" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:scrollbars="vertical" >
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/HorizontalScrollView" android:layout_width="wrap_content" android:layout_height="wrap_content">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/DisplayResults" android:layout_width="fill_parent" android:layout_height="fill_parent" >
<TableRow > <TextView android:layout_column="1" android:text="Title" android:padding="3dip" /> <TextView android:layout_column="2" android:text="Author" android:padding="3dip"/> <TextView android:layout_column="3" android:text="File" android:padding="3dip"/> <TextView android:layout_column="4" android:text="ModDate" android:padding="3dip"/> <TextView android:layout_column="5" android:text="Size" android:padding="3dip"/> </TableRow>
</TableLayout>
</HorizontalScrollView>
</ScrollView> |
| Código : | package citic. android. remoteir; import java.util.ArrayList;import java.util.Iterator;import android.app.Activity;import android.os.Bundle;import android.widget.TableRow.LayoutParams;import android.widget.Button;import android.widget.LinearLayout;import android.widget.ScrollView;import android.widget.TableLayout;import android.view.View;import android.view.ViewGroup;import android.widget.TableRow;import android.widget.TextView;import android.app.Activity;public class DisplayResult extends Activity { private boolean mShrink; @SuppressWarnings ("unchecked") protected void onCreate (Bundle savedInstanceState ) { super. onCreate(savedInstanceState ); setContentView (R. layout. displayresults); Bundle extras = getIntent (). getExtras(); final TableLayout tl = (TableLayout )findViewById (R. id. DisplayResults); //ArrayList finalResults; if(extras!= null){ appendRow (tl, extras ); } } private void appendRow (TableLayout table, Bundle extras ) { ArrayList finalResults; finalResults = (ArrayList) (extras. getSerializable(RemoteIR. RESULTS)); Iterator it = finalResults. iterator(); while(it. hasNext()) { SearchResult result = ((SearchResult) it. next()); TableRow tr = new TableRow (this); tr. setLayoutParams(new LayoutParams ( LayoutParams. FILL_PARENT, LayoutParams. WRAP_CONTENT)); TextView title = new TextView (this); title. setText(result. title); title. setPadding(3, 3, 3, 3); TextView author = new TextView (this); author. setText(result. author. toString()); author. setPadding(3, 3, 3, 3); TextView file = new TextView (this); file. setText(result. file. toString()); TextView modDate = new TextView (this); modDate. setText(result. modDate); TextView size = new TextView (this); size. setText(result. size. toString()); tr. addView(title, new TableRow. LayoutParams(1)); tr. addView(author, new TableRow. LayoutParams()); tr. addView(file, new TableRow. LayoutParams()); tr. addView(modDate, new TableRow. LayoutParams()); tr. addView(size, new TableRow. LayoutParams()); table. addView(tr, new TableLayout. LayoutParams( LayoutParams. FILL_PARENT, LayoutParams. WRAP_CONTENT)); } }} |
No tengo ni idea de por que desaparece :s |
|
JaVaK 
|
Publicado: Jue Feb 04, 2010 2:30 am Título del mensaje: |
|
|
| Si has puesto todo el código me lo copiaré al eclipse y lo intento ver, porque con tanto código aquí no se ve. |
|
zash 
|
Publicado: Jue Feb 04, 2010 12:38 pm Título del mensaje: |
|
|
| Tendria que poner el codigo de la 1ª actividad la que envia los datos o no es necesario? (o si no enviar un paquete con todo). |
|
JaVaK 
|
Publicado: Jue Feb 04, 2010 12:50 pm Título del mensaje: |
|
|
Si no quieres publicarlo todo que lo entiendo, mándame algo que pueda abrir directamente en Eclipse a javak@android-spa.com y te lo miro.
Saludos. |
|
zash 
|
Publicado: Jue Feb 04, 2010 1:53 pm Título del mensaje: |
|
|
| Tienes un mp ^^ |
|
|
No puede crear mensajes No puede responder temas No puede editar sus mensajes No puede borrar sus mensajes No puede votar en encuestas
|
|