Browse a gallery and put in a scrollview

Asked

Viewed 208 times

0

I’m using this to use as an image gallery .

<android.support.v4.view.ViewPager
    android:id="@+id/galeria"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="80dp"
    android:layout_alignParentTop="true" />

no longer working when I put inside a Scrollview

inserir a descrição da imagem aqui

This is my layout, the text does not fit all on the screen in a few moments I need a Scrollview ,I wanted to put the gallery inside it to upload the photo and the text , I only managed to put in the text there is not very good because some people will not try to upload only the text

I’m adding the images like this Aki no main

ViewPager galeria = (ViewPager) findViewById(R.id.galeria);
    GaleriaImagensAdapter adapter = null;
    try {
        adapter = new GaleriaImagensAdapter(this, packageName, id);
    } catch (SQLException e) {
        e.printStackTrace();
    }
    galeria.setAdapter(adapter);

and the Adapter

 @Override
public Object instantiateItem(ViewGroup pager, int position) {
    ImageView imagem = new ImageView(context);
    imagem.setScaleType(ImageView.ScaleType.CENTER_INSIDE);

    try {
        String nome_foto = itens.get(position).nome_foto;
        int drawableId = context.getResources().getIdentifier(nome_foto, "drawable", packageName);

        imagem.setImageResource(drawableId);
    }
    catch (Exception e) {
        Log.e("MyTag", "Failure to get drawable id.", e);
    }
    ((ViewPager) pager).addView(imagem, 0);
    return imagem;
}
  • What do you mean it’s not working? It’s not going between the items? How are you adding the images into your ViewPager? If you could post a code snippet it would be great

  • type of the way it is works normal , no longer have a scroll on the whole screen, then when I put inside the scroll it disappears, no more appears

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.