Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8791489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:50:59+00:00 2026-06-13T22:50:59+00:00

For my app I have a base main activity, which holds a pageviewer. In

  • 0

For my app I have a base main activity, which holds a pageviewer.
In the activity class I have:

MyPagerAdapter adapter = new MyPagerAdapter(this);
viewPager.setAdapter(adapter);

The adapter class looks like:

private class MyPagerAdapter extends PagerAdapter {

private ArrayList<LinearLayout> views;

public MyPagerAdapter(Context context) {
    views = new ArrayList<LinearLayout>();
    views.add(new questionListView(context));
}

    @Override
    public void destroyItem(View view, int arg1, Object object) {
        ((ViewPager) view).removeView((LinearLayout) object);
    }

    @Override
    public void finishUpdate(View arg0) {

    }

    @Override
    public int getCount() {
        return views.size();
    }

    @Override
    public Object instantiateItem(View view, int position) {
        View myView = views.get(position);
        ((ViewPager) view).addView(myView);
        return myView;
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    @Override
    public void restoreState(Parcelable arg0, ClassLoader arg1) {

    }

    @Override
    public Parcelable saveState() {
        return null;
    }

    @Override
    public void startUpdate(View arg0) {

    }

    }
    }
}

The questionListView class looks like:

public class questionListView extends LinearLayout {

public questionListView(Context context, AttributeSet attrs) {
    super(context, attrs);
    init();
}

public questionListView(Context context) {
    super(context);
    init();
}

private void init() {

    LayoutInflater factory = LayoutInflater.from(getContext());
    View myView = factory.inflate(R.layout.view1,null);

    addView(myView);

}

}

Main activity layout:

<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/pager"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <!--
    This title strip will display the currently visible page title, as well as the page
    titles for adjacent pages.
    -->

    <android.support.v4.view.PagerTitleStrip
        android:id="@+id/pager_title_strip"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="top"
        android:alpha="4"
        android:paddingBottom="4dp"
        android:paddingTop="4dp"
        android:textColor="#000000" />

</android.support.v4.view.ViewPager>

view1 is a layout view, a linearlayout with other layouts in them.

When I run the app the main activity is shown, but the view with the view1-layout is not.

Why not, what am I doing wrong here?
I’m not getting any errors.

rg,
Eric

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:51:00+00:00Added an answer on June 13, 2026 at 10:51 pm

    Luksprog help solved the problem.
    Setting the PagerTitleStrip to wrap_content solved it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a Rails app I have Sales and Salespeople: class Sale < ActiveRecord::Base belongs_to
I am writing an Android app. I have an activity in my main project
I have Backbone App Here are codes : This is Main.coffee : require [App/app,backbone]
I have two WARS: base-overlay example-app base-overlay has XML config files in src/main/webapp/WEB-INF/spring/*.xml .
I have a base class which is a Riak entity, and some derived classes
I have an app that consists of a main rails 3.2 app which acts
I have an Android app where I've extended the base Application class in order
I have an app on the store, with populated data in a CoreData base.
I have created an app targeted for ios 4.1 with base SDK ios 5.0
In my app have a sign in activity. If login is successful, I start

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.