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 6735107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:58:08+00:00 2026-05-26T10:58:08+00:00

I am trying to put a scroll view to relative layout. Here some part

  • 0

I am trying to put a scroll view to relative layout. Here some part of the layout on the upper and bottom part are to be constant. So I’m using one more layout inside,which has items that need to be scrolled.

But this is not at all happening, also the screen looks very bad with this. I am getting some black space in the bottom of the part where I defined scroll view.

Here is my xml,

 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView android:id="@+id/textView1" android:layout_below="@+id/logoTop"
    android:layout_height="wrap_content" android:layout_width="wrap_content"
    android:text="TextView" android:layout_alignLeft="@+id/logoTop"></TextView>

<ImageView android:src="@drawable/logotop" android:id="@+id/logoTop"
    android:layout_alignParentTop="true" android:layout_width="match_parent"  
    android:scaleType="fitXY" android:layout_height="wrap_content"></ImageView>

<ImageView android:src="@drawable/bardown" android:id="@+id/barDown"
    android:layout_width="match_parent" android:scaleType="fitXY"
    android:layout_alignParentBottom="true" android:layout_height="40dip">
</ImageView>

<ImageButton 
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:id="@+id/btnMap" android:layout_centerInParent="true" android:src="@drawable/map"
    android:background="@drawable/mapselector" android:scaleType="fitXY"
    android:layout_alignParentBottom="true">
</ImageButton>

<ImageButton 
    android:layout_width="wrap_content" android:layout_height="wrap_content"
    android:id="@+id/utBtn" android:background="@drawable/utilitiesicon"
    android:scaleType="fitXY" android:layout_alignTop="@+id/barDown" android:src="@drawable/utilityselector"
    android:layout_alignParentRight="true" android:layout_marginRight="10dip"
    android:layout_marginTop="3dip">
</ImageButton>

 <ScrollView 
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_below="@+id/logoTop"
  android:layout_above="@+id/barDown"
  android:scrollbars="none">

    <RelativeLayout  android:id="@+id/tour" 
    android:layout_width="wrap_content" android:layout_height="wrap_content">

<ImageView android:id="@+id/abtHome" android:layout_below="@+id/logoTop"
    android:src="@drawable/abouthome" android:scaleType="fitXY"
    android:layout_width="match_parent" android:maxWidth="230dip"
    android:layout_height="230dip">
</ImageView> 

<ListView android:id="@+id/tourList" android:layout_below="@+id/abtHome"
    android:scrollbars="none" android:visibility="visible"
    android:layout_centerInParent="true" android:layout_above="@+id/barDown"
    android:background="#FFFFFF" android:cacheColorHint="#00000000" android:fadingEdge="horizontal"
    android:fastScrollEnabled="true" android:layout_width="wrap_content" 
    android:layout_height="wrap_content" android:isScrollContainer="false">
</ListView> 

<TextView android:id="@+id/tourcity" android:layout_above="@+id/tourList"
    android:layout_height="wrap_content" android:layout_width="match_parent"
    android:textSize="25dip" android:layout_centerHorizontal="true"
    android:editable="false" android:paddingTop="5dip" android:textColor="@color/white"
    android:paddingBottom="5dip" android:background="#80000000" android:gravity="center"></TextView>

</RelativeLayout>
</ScrollView>

<ImageButton android:src="@drawable/arrowselector"
    android:layout_height="wrap_content" android:layout_width="wrap_content"   android:layout_alignTop="@+id/barDown"
    android:id="@+id/btnBack" android:background="@drawable/arrowleft" android:layout_marginLeft="10dip"
     android:layout_marginTop="6dip"></ImageButton>

   </RelativeLayout>

Any answer for this?

  • 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-05-26T10:58:09+00:00Added an answer on May 26, 2026 at 10:58 am

    I solved the issue. It is not good to fit the list view inside scroll view. So what I did is, placed 1 text view and image view in one xml and inflate that in List Adapter.

    I placed these 2 fields in another xml say listbox2.xml

     <ImageView android:id="@+id/abtHome" android:layout_below="@+id/logoTop"
        android:src="@drawable/abouthome" android:scaleType="fitXY"
        android:layout_width="match_parent" android:maxWidth="230dip"
        android:layout_height="230dip">
    </ImageView> 
    
    <TextView android:id="@+id/tourcity" android:layout_below = "@+id/abtHome"
        android:layout_height="wrap_content" android:layout_width="match_parent"
        android:textSize="25dip" android:layout_centerHorizontal="true"
        android:editable="false" android:paddingTop="5dip" android:textColor="@color/white"
        android:paddingBottom="5dip" android:background="#80000000" android:gravity="center"></TextView>
    

    Now inside my list adapter, am doing like this

       public View getView(int position, View convertView, ViewGroup parent) {
    
        if(position == 0) {
            convertView = mInflater.inflate(R.layout.listbox2, null);
            TextView cityLabel = (TextView) convertView.findViewById(R.id.tourcity);
            cityLabel.setText("Some Text");
            return convertView;
        }
    
        else if (convertView == null || convertView.getTag() == null) {
            convertView = mInflater.inflate(R.layout.listbox, null);
            convertView.setOnClickListener(clickListener);
            holder = new ViewHolder();
            holder.view1 = (TextView) convertView.findViewById(R.id.listText);
            holder.desc = (TextView) convertView.findViewById(R.id.editText1);
            holder.index = (TextView) convertView.findViewById(R.id.index);
            holder.desc.setVisibility(View.GONE);
            holder.priceBtn = (Button) convertView.findViewById(R.id.prcBtn);
            holder.icon = (ImageView) convertView.findViewById(R.id.listIcon);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
    
            return convertView;
     }
    

    If the position is 0, I am inflating this new xml where I kept the above 2 fields or else it continues in a normal way.

    Hope my answer is clear

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

Sidebar

Related Questions

I am trying to put some distributed caching into play, I'm using this indeXus.Net
I'm trying to put a button at the bottom of a webview. For some
I'm trying to achieve scroll view with multiple images. I put the UIScrollView and
I'm trying to put in an exception in my web.config so that one page
I am trying to do a layout similar to the one used in iphone
I'm trying to put together a horizontal content slider using JQueryMobile. The following code
I am trying to put some loooong text into an AlertDialog. The only issue
I'm trying to put the buttonbar I've created on the bottom of each screen.
I'm trying to put two blocks into one fixed-height block to create the following
I am trying to show a picture in it's full view using QGraphicsScene. But

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.