Rectangle 27 2

You can't put a ListView inside a ScrollView. Of GridView, or whatever View that handles scrolling on the same axis as the ScrollView does. That way the framework wouldn't know which View should handle the scrolling event. This layout won't produce an error when you compile it, but it won't work properly.

What you should do here: dump the outer ScrollView, you don't need it. Only use a ListView, and add the button to the ListView, using .addFooter(), that's the easiest way. This way your button'll appear as a list element, but you don't have to mess around with a custom adapter.

android - list inside scrollview - Stack Overflow

android list scroll scrollview
Rectangle 27 1

I have some very specific customized needs for a keyboard solution -- requiring me to handle the display and tear-down of the keyboard on my own as a z-layer element in a frameLayout. I use the solution in that link to accomplish that and change the size of the scrollView at the same time. The buttons in the scroll view move from flush with the bottom of the screen to flush with the top of the keyboard.

The key is having android:fillViewport="true" on the scrollView. Then programmatically setting the bottom margin of the scrollView to and the top margin of the bottom element to -height.

private void setMargins_noKeyboard()
{
    ScrollView fieldsScroller = (ScrollView)findViewById(R.id.scroll_fields_view);
    FrameLayout keyboardFrame = (FrameLayout)findViewById(R.id.keyboard_root);
    int buttonsKeyboardSize = keyboardFrame.getHeight();

    MarginLayoutParams frameParams = (MarginLayoutParams)keyboardFrame.getLayoutParams();
    frameParams.setMargins(0, 0, 0, 0);

    MarginLayoutParams scrollParams = (MarginLayoutParams)fieldsScroller.getLayoutParams();
    scrollParams.setMargins(0, 0, 0, 0);

    keyboardFrame.setLayoutParams(frameParams);
    fieldsScroller.setLayoutParams(scrollParams);
}

private void setMargins_keyboard()
{
    ScrollView fieldsScroller = (ScrollView)findViewById(R.id.scroll_fields_view);
    FrameLayout keyboardFrame = (FrameLayout)findViewById(R.id.keyboard_root);
    int buttonsKeyboardSize = keyboardFrame.getHeight();

    MarginLayoutParams frameParams = (MarginLayoutParams)keyboardFrame.getLayoutParams();
    frameParams.setMargins(0, -buttonsKeyboardSize, 0, 0);

    MarginLayoutParams scrollParams = (MarginLayoutParams)fieldsScroller.getLayoutParams();
    scrollParams.setMargins(0, 0, 0, buttonsKeyboardSize);

    keyboardFrame.setLayoutParams(frameParams);
    fieldsScroller.setLayoutParams(scrollParams);
}

After working with this quite a bit more, I have found that while the above answer works there is a better solution. Using a relative layout works very reliably without all the programatic gyrations of this answer. The key is at least one element that aligns with parent top and one element that aligns with parent bottom. The rest of the elements align relative to these two, the scrollview ultimately is sandwiched between anything that needs to remain stationary.

android - buttons below expanding scrollview - Stack Overflow

android user-interface android-layout
Rectangle 27 23

Is the goal just to have a scrollable area that takes up the entire page minus the amount taken up by some buttons at the bottom?

If that's the case, you can use a LinearLayout at the outer level and make use of weights:

<LinearLayout 
   android:layout_height="wrap_content" 
   orientation="vertical"...>
   <ScrollView
      android:layout_height="0dp"
      android:layout_weight="1"
      .../>
   <LayoutWithButtons
      android:layout_height="wrap_content"
      ..../>
</LinearLayout>

Sorry, I guess it was not clear... added a sketch...

Hmm, what happens if you set the outer LinearLayout to wrap_content? If that doesn't work on its own, wrap it in another LinearLayout with a greedy (height=0, weight=1) invisible element below it?

It still expands and pushes the buttons out of the screen...

Setting the outer Layout with wrap_content worked. If I add the other greedy invisible Layout, the buttons would be stuck in the middle of the screen. But you got it.. thanks !

I'm getting an error that layout_height="0" is not a valid value, but using wrap_content seems to work perfectly.

android - buttons below expanding scrollview - Stack Overflow

android user-interface android-layout
Rectangle 27 2

In the end, I found the following solution did exactly what I needed:

@Override
public boolean onTouchEvent(MotionEvent ev)
{
    App.log("onTouchEvent, with action : " + ev.getAction());
    switch(ev.getAction())
    {
        case MotionEvent.ACTION_MOVE:
            return false;
    }
    return super.onTouchEvent(ev);
}

Disable Android scrollview, but still allow taps on buttons in the scr...

android scrollview ontouchevent
Rectangle 27 1

I have tried and tested nearly all the methods mentioned above, trust me, after completely running away from RecyclerView, I replaced my ListView with RecyclerView and it worked perfectly. Didnt need any 3rd Party library for ExtendedHeightListView and all, just plain and simple RecyclerView.

<?xml version="1.0" encoding="utf-8"?>

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:elevation="5dp">

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/relativeLayoutre"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    tools:context="com.example.android.udamovappv3.activities.DetailedActivity">

    <android.support.v7.widget.Toolbar
        android:id="@+id/my_toolbar_detail"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:layout_gravity="top"
        android:background="?attr/colorPrimary"
        android:elevation="4dp"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    <TextView
        android:id="@+id/title_name"
        android:layout_width="fill_parent"
        android:layout_height="128dp"
        android:layout_alignParentStart="true"
        android:layout_marginTop="59dp"
        android:background="#079ED9"
        android:gravity="left|center"
        android:padding="25dp"
        android:text="Name"
        android:textColor="#ffffff"
        android:textSize="30sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="@+id/my_toolbar_detail"
        app:layout_constraintVertical_bias="0.0"
        tools:layout_editor_absoluteX="0dp" />


    <ImageView
        android:id="@+id/iv_poster"
        android:layout_width="131dp"
        android:layout_height="163dp"
        android:layout_alignStart="@+id/my_toolbar_detail"
        android:layout_below="@+id/title_name"
        android:layout_marginBottom="15dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="15dp"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:srcCompat="@mipmap/ic_launcher" />

    <Button
        android:id="@+id/bt_mark_as_fav"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/iv_poster"
        android:layout_alignParentEnd="true"
        android:layout_marginBottom="11dp"
        android:layout_marginEnd="50dp"
        android:background="#079ED9"
        android:text="Mark As \n Favorite"
        android:textSize="10dp" />

    <TextView
        android:id="@+id/tv_runTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/tv_rating"
        android:layout_below="@+id/tv_releaseDate"
        android:layout_marginTop="11dp"
        android:text="TextView"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/tv_releaseDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/tv_runTime"
        android:layout_alignTop="@+id/iv_poster"
        android:text="TextView"
        android:textSize="25dp" />

    <TextView
        android:id="@+id/tv_rating"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/bt_mark_as_fav"
        android:layout_below="@+id/tv_runTime"
        android:layout_marginTop="11dp"
        android:text="TextView" />

    <TextView
        android:id="@+id/tv_overview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/iv_poster"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="5dp"
        android:foregroundGravity="center"
        android:text="adasdasdfadfsasdfasdfasdfasdfnb agfjuanfalsbdfjbdfklbdnfkjasbnf;kasbdnf;kbdfas;kdjabnf;lbdnfo;aidsnfl';asdfj'plasdfj'pdaskjf'asfj'p[asdfk"
        android:textColor="#000000"
         />


    <RelativeLayout
        android:id="@+id/foodItemActvity_linearLayout_fragments"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_below="@+id/tv_overview">
        <TextView
            android:id="@+id/fragment_dds_review_textView_label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Reviews:"

            android:textAppearance="?android:attr/textAppearanceMedium" />
        <com.github.paolorotolo.expandableheightlistview.ExpandableHeightListView
            android:id="@+id/expandable_listview"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_alignParentBottom="true"
            android:layout_alignParentStart="true"
            android:layout_below="@+id/fragment_dds_review_textView_label"
            android:padding="8dp">

        </com.github.paolorotolo.expandableheightlistview.ExpandableHeightListView>
    </RelativeLayout>
</RelativeLayout>
</ScrollView>

THIS IS AFTER REPLACING MY LISTVIEW WITH ONE OF THE MANY SOLUTIONS MENTIONED ABOVE. So the problem was that the listview was not behaving properly due to 2 scrollview bug(maybe not a bug) in android.

public class TrailerAdapter extends RecyclerView.Adapter<TrailerAdapter.TrailerAdapterViewHolder> {

private ArrayList<String> Youtube_URLS;

private Context Context;

public TrailerAdapter(Context context, ArrayList<String> Youtube_URLS){
    this.Context = context;
    this.Youtube_URLS = Youtube_URLS;
}
@Override
public TrailerAdapter.TrailerAdapterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.trailer_layout, parent, false);
    return new TrailerAdapterViewHolder(view);
}

@Override
public void onBindViewHolder(TrailerAdapter.TrailerAdapterViewHolder holder, int position) {
    Picasso.with(Context).load(R.drawable.ic_play_arrow_black_24dp).into(holder.iv_playbutton);
    holder.item_id.setText(Youtube_URLS.get(position));
}

@Override
public int getItemCount() {
    if(Youtube_URLS.size()==0){
        return 0;
    }else{
        return Youtube_URLS.size();
    }
}

public class TrailerAdapterViewHolder extends RecyclerView.ViewHolder {
    ImageView iv_playbutton;
    TextView item_id;

    public TrailerAdapterViewHolder(View itemView) {
        super(itemView);
        iv_playbutton = (ImageView)itemView.findViewById(R.id.play_button);
        item_id = (TextView)itemView.findViewById(R.id.tv_trailer_sequence);
    }
}
}
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="56dp"
    android:padding="6dip" >

    <ImageView
        android:id="@+id/play_button"
        android:layout_width="70dp"
        android:layout_height="wrap_content"
        android:layout_marginRight="6dip"
        android:layout_marginStart="12dp"
        android:src="@drawable/ic_play_arrow_black_24dp"
        android:layout_centerVertical="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:id="@+id/tv_trailer_sequence"
        android:layout_width="wrap_content"
        android:layout_height="26dip"
        android:layout_centerVertical="true"
        android:layout_toEndOf="@+id/play_button"
        android:ellipsize="marquee"
        android:gravity="center"
        android:maxLines="1"
        android:text="Description"
        android:textSize="12sp" />

</RelativeLayout>

And VOILA, I got the desired effect of ListView(Now RecyclerView) within a scollview. Heres the Final Image of the UI

On a final note, I believe that replacing the RecyclerView was a better choice for me, as it improved the overall app stability, and also helped me understand RecyclerView better. If I were to suggest a solution, Im going to say replace your ListView with a RecyclerView.

ListView inside ScrollView is not scrolling on Android - Stack Overflo...

android listview android-layout scrollview
Rectangle 27 1

I have tried and tested nearly all the methods mentioned above, trust me, after completely running away from RecyclerView, I replaced my ListView with RecyclerView and it worked perfectly. Didnt need any 3rd Party library for ExtendedHeightListView and all, just plain and simple RecyclerView.

<?xml version="1.0" encoding="utf-8"?>

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/scrollView"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:elevation="5dp">

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/relativeLayoutre"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="2dp"
    tools:context="com.example.android.udamovappv3.activities.DetailedActivity">

    <android.support.v7.widget.Toolbar
        android:id="@+id/my_toolbar_detail"
        android:layout_width="match_parent"
        android:layout_height="56dp"
        android:layout_gravity="top"
        android:background="?attr/colorPrimary"
        android:elevation="4dp"
        android:theme="@style/ThemeOverlay.AppCompat.ActionBar"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />

    <TextView
        android:id="@+id/title_name"
        android:layout_width="fill_parent"
        android:layout_height="128dp"
        android:layout_alignParentStart="true"
        android:layout_marginTop="59dp"
        android:background="#079ED9"
        android:gravity="left|center"
        android:padding="25dp"
        android:text="Name"
        android:textColor="#ffffff"
        android:textSize="30sp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintHorizontal_bias="1.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="@+id/my_toolbar_detail"
        app:layout_constraintVertical_bias="0.0"
        tools:layout_editor_absoluteX="0dp" />


    <ImageView
        android:id="@+id/iv_poster"
        android:layout_width="131dp"
        android:layout_height="163dp"
        android:layout_alignStart="@+id/my_toolbar_detail"
        android:layout_below="@+id/title_name"
        android:layout_marginBottom="15dp"
        android:layout_marginRight="8dp"
        android:layout_marginTop="15dp"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:srcCompat="@mipmap/ic_launcher" />

    <Button
        android:id="@+id/bt_mark_as_fav"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/iv_poster"
        android:layout_alignParentEnd="true"
        android:layout_marginBottom="11dp"
        android:layout_marginEnd="50dp"
        android:background="#079ED9"
        android:text="Mark As \n Favorite"
        android:textSize="10dp" />

    <TextView
        android:id="@+id/tv_runTime"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/tv_rating"
        android:layout_below="@+id/tv_releaseDate"
        android:layout_marginTop="11dp"
        android:text="TextView"
        android:textSize="20sp" />

    <TextView
        android:id="@+id/tv_releaseDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/tv_runTime"
        android:layout_alignTop="@+id/iv_poster"
        android:text="TextView"
        android:textSize="25dp" />

    <TextView
        android:id="@+id/tv_rating"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignStart="@+id/bt_mark_as_fav"
        android:layout_below="@+id/tv_runTime"
        android:layout_marginTop="11dp"
        android:text="TextView" />

    <TextView
        android:id="@+id/tv_overview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_below="@+id/iv_poster"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="5dp"
        android:foregroundGravity="center"
        android:text="adasdasdfadfsasdfasdfasdfasdfnb agfjuanfalsbdfjbdfklbdnfkjasbnf;kasbdnf;kbdfas;kdjabnf;lbdnfo;aidsnfl';asdfj'plasdfj'pdaskjf'asfj'p[asdfk"
        android:textColor="#000000"
         />


    <RelativeLayout
        android:id="@+id/foodItemActvity_linearLayout_fragments"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_below="@+id/tv_overview">
        <TextView
            android:id="@+id/fragment_dds_review_textView_label"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Reviews:"

            android:textAppearance="?android:attr/textAppearanceMedium" />
        <com.github.paolorotolo.expandableheightlistview.ExpandableHeightListView
            android:id="@+id/expandable_listview"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:layout_alignParentBottom="true"
            android:layout_alignParentStart="true"
            android:layout_below="@+id/fragment_dds_review_textView_label"
            android:padding="8dp">

        </com.github.paolorotolo.expandableheightlistview.ExpandableHeightListView>
    </RelativeLayout>
</RelativeLayout>
</ScrollView>

THIS IS AFTER REPLACING MY LISTVIEW WITH ONE OF THE MANY SOLUTIONS MENTIONED ABOVE. So the problem was that the listview was not behaving properly due to 2 scrollview bug(maybe not a bug) in android.

public class TrailerAdapter extends RecyclerView.Adapter<TrailerAdapter.TrailerAdapterViewHolder> {

private ArrayList<String> Youtube_URLS;

private Context Context;

public TrailerAdapter(Context context, ArrayList<String> Youtube_URLS){
    this.Context = context;
    this.Youtube_URLS = Youtube_URLS;
}
@Override
public TrailerAdapter.TrailerAdapterViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.trailer_layout, parent, false);
    return new TrailerAdapterViewHolder(view);
}

@Override
public void onBindViewHolder(TrailerAdapter.TrailerAdapterViewHolder holder, int position) {
    Picasso.with(Context).load(R.drawable.ic_play_arrow_black_24dp).into(holder.iv_playbutton);
    holder.item_id.setText(Youtube_URLS.get(position));
}

@Override
public int getItemCount() {
    if(Youtube_URLS.size()==0){
        return 0;
    }else{
        return Youtube_URLS.size();
    }
}

public class TrailerAdapterViewHolder extends RecyclerView.ViewHolder {
    ImageView iv_playbutton;
    TextView item_id;

    public TrailerAdapterViewHolder(View itemView) {
        super(itemView);
        iv_playbutton = (ImageView)itemView.findViewById(R.id.play_button);
        item_id = (TextView)itemView.findViewById(R.id.tv_trailer_sequence);
    }
}
}
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="56dp"
    android:padding="6dip" >

    <ImageView
        android:id="@+id/play_button"
        android:layout_width="70dp"
        android:layout_height="wrap_content"
        android:layout_marginRight="6dip"
        android:layout_marginStart="12dp"
        android:src="@drawable/ic_play_arrow_black_24dp"
        android:layout_centerVertical="true"
        android:layout_alignParentStart="true" />

    <TextView
        android:id="@+id/tv_trailer_sequence"
        android:layout_width="wrap_content"
        android:layout_height="26dip"
        android:layout_centerVertical="true"
        android:layout_toEndOf="@+id/play_button"
        android:ellipsize="marquee"
        android:gravity="center"
        android:maxLines="1"
        android:text="Description"
        android:textSize="12sp" />

</RelativeLayout>

And VOILA, I got the desired effect of ListView(Now RecyclerView) within a scollview. Heres the Final Image of the UI

On a final note, I believe that replacing the RecyclerView was a better choice for me, as it improved the overall app stability, and also helped me understand RecyclerView better. If I were to suggest a solution, Im going to say replace your ListView with a RecyclerView.

ListView inside ScrollView is not scrolling on Android - Stack Overflo...

android listview android-layout scrollview
Rectangle 27 1

You can override overscrollBy() and change the deltaX & deltaY values to 0 if disabled.

@Override
protected boolean overScrollBy(int deltaX, int deltaY, int scrollX, int scrollY, int scrollRangeX, int scrollRangeY, int maxOverScrollX, int maxOverScrollY, boolean isTouchEvent)
{
    final int dx;
    final int dy;

    if (isEnabled())
    {
        dx = deltaX;
        dy = deltaY;
    }
    else
    {
        dx = 0;
        dy = 0;
    }

    return super.overScrollBy(dx, dy, scrollX, scrollY, scrollRangeX, scrollRangeY, maxOverScrollX, maxOverScrollY, isTouchEvent);
}

You'll probably also want to dynamically hide/show the scroll bar too on disabling/enabling.

Hmmm... doesn't seem like the right answer, surely there's a way to stop the scrolling at the beginning without worrying about this 'overscroll' busines (and couldn't I just disable over-scrolling anyway with setOverScrollMode?)

ScrollView performs its scrolling using that method. Admittedly it's hardly a perfect solution, but without a specific allowScrolling(boolean) or similar on ScrollView's interface to perform what you want, I think it's as good as any other method.

Disable Android scrollview, but still allow taps on buttons in the scr...

android scrollview ontouchevent
Rectangle 27 0

You should place your LinearLayout inside the ScrollView, because ScrollView is a container and its children are scrollable. Also, set the ScrollView as the activity's content view and define its layout params.

ScrollView scrollView = new ScrollView(this);
scrollView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
scroll.addView(mLinearLayout);
setContentView(scroll);

I am confused can you show me how to do it?

Could you please post the XML where you defined the LinearLayout "R.id.linear1"?

I will post it and what you suggested did not work either :/

android - Add a button within a ScrollView - Stack Overflow

android button radio-button scrollview
Rectangle 27 0

In case this helps someone else.....

All the Activities that were hosted inside the TabHost had android:windowSoftInputMode = adjustPan.

However, the Activity that hosted the TabHost was missing android:windowSoftInputMode = adjustPan. Once I added that, the panning worked the smae inside a TabHost or outside the TabHost.

android - ScrollView with Button Below Scrolls Different Inside TabHos...

android scroll scrollview android-tabhost
Rectangle 27 0

I've worked with scroll views more often then I would have liked. Trust me, from experience, trying to control its scrolling and interception of gestures is just asking for trouble. When the user goes to sign inside of the scrollview, move the custom signature view from within the scrollview to a custom (and perhaps full screen) dialog with a Cancel/Done button.

Your users will thank you for a large and easier signature space, and the solution should work much better into the future and will not depend on the scroll view to allow you to track touches within it.

objective c - Drawing view inside UIScrollView - Stack Overflow

objective-c cocoa-touch ios uiview uiscrollview
Rectangle 27 0

You can also put your scrollView inside another layout. Have one vertical LinearLayout with two Layouts inside, one for your everything that should scroll with layout_weight="1" and at the bottom another layout that consist of your buttons

Vertical LinearLayout
    LinearLayout with layout_weight="1"
        ScrollView
            Layout containing your stuff
    layout containing buttons

android - Relative layout within Linear layout is scrollview possible?...

android android-layout scrollview android-linearlayout android-relativelayout
Rectangle 27 0

Perhaps I've misunderstand your question, but it sounds like you want a stationary Button outside of your ScrollView so that you can scroll and always see the Button?

If so, just add the Button OUTSIDE the ScrollView:

<Button
    android:id="@+id/button_save"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Save" />

<ScrollView
    android:id="@+id/scrollView_list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    </LinearLayout>
</ScrollView>

How to add a floating button on scrolling in android? - Stack Overflow

android button scrollview
Rectangle 27 0

it means both of your layouts are interdependent on each other.

I have tried setting the layout_width for Linear layout to "fill_parent" but that doesn't help either. Those button inside the scrollview is still having unequal width.

just remove the weight attribute. either hardcode the width of the buttons or set it to wrap-content.

Look like there is no choice but to hardcoded the width then. Thanks, it work after i hardcoded it and remove the weight attribute.

android - Unable to set the weight of buttons inside scrollview - Stac...

android scrollview
Rectangle 27 0

Question doesn't state if button is cut of by scrollview not scrolling down enough. But if that's the case you have to change UITableViews (UIScrollView) contentsize.

CGSize wholesize =  self.tableView.contentSize;

wholesize.height = self.tableView.contentSize.height + self.tableView.tableFooterView.frame.size.height;

self.tableView.contentSize = wholesize;

ios - UIView in tableFooterView property doesn't fit inside UITabelVie...

ios uitableview
Rectangle 27 0

Perhaps I've misunderstand your question, but it sounds like you want a stationary Button outside of your ScrollView so that you can scroll and always see the Button?

If so, just add the Button OUTSIDE the ScrollView:

<Button
    android:id="@+id/button_save"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Save" />

<ScrollView
    android:id="@+id/scrollView_list"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:id="@+id/linearLayout2"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
    </LinearLayout>
</ScrollView>

Outside the button and scrollview, a relativelayout can be used to wrap. And the Button can be used with android:layout_alignParentBottom="true",android:layout_alignParentRight="true" to align to the rightbottom position of parent.

How to add a floating button on scrolling in android? - Stack Overflow

android button scrollview
Rectangle 27 0

In the end, I found the following solution did exactly what I needed:

@Override
public boolean onTouchEvent(MotionEvent ev)
{
    App.log("onTouchEvent, with action : " + ev.getAction());
    switch(ev.getAction())
    {
        case MotionEvent.ACTION_MOVE:
            return false;
    }
    return super.onTouchEvent(ev);
}

Disable Android scrollview, but still allow taps on buttons in the scr...

android scrollview ontouchevent
Rectangle 27 0

If you are trying to create a view where the upper portion of the screen is a scrolling list, and the bottom portion is a button, put the scrollview inside a linearlayout, and put the button in the linearlayout below the scrollview.

Set ScrollView + Fixed Button Programatically on Android with setText....

android scrollview css-position
Rectangle 27 0

You can implement onTouch of your button with nothing than

return true;

this will make the button not consume the Event.

scrollview - Android and buttons inside scroll views - Stack Overflow

android scrollview
Rectangle 27 0

Try putting the ScrollView inside the MetroLikeLayout around just the buttons like this...

<com.uberaktiv.ui.layout.MetroLikeLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
    <ScrollView android:layout_width="match_parent" android:id="@+id/scrollView1" android:layout_height="fill_parent" android:layout_weight="1.0">
        <Button android:text="Button 1" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
        <Button android:text="Button 2" android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
        <Button android:text="Button 3" android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
        <Button android:text="Button 4" android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
        <Button android:text="Button 5" android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button>
    </ScrollView>
</com.uberaktiv.ui.layout.MetroLikeLayout>

Thanks MisterSquonk. I will try your solution, although I fear, at first glance it may not do. The MetroLikeLayout view goes over its direct children and positions them according to the calculated sizes, which allow the requested functionality. my initial thought is that my view will calculate and try resize and reposition of the scrollview and not the children. however, i will try and may need to change the code. Thanks for the help.

MisterSquonk, even though i prefer to understand what's the problem with my layout settings, i now thought of an idea in which i will programaticaly add a scroll view to my custom view and then loop through the children. but even just for academic reasons, I'd like to know what i'm missing in my layout above.

user interface - android vertical scroll bar and content not visible -...

android user-interface view scroll
Rectangle 27 0

It's actually not displaying only for the last button - it's displaying for each button, but in the same position. The problem is that Button is not a layout, and as such, does not perform layout of its children. So the GridLayout for each button is rendered at 0, 0 with size 100, 100 relative to the origin of the nearest relative parent (in this case, the GridLayout grid_l because it is contained by the ScrollView).

When you add widgets to a non-layout widget, it's up to you to layout those widgets by setting position and size. Note that you must set the actual pos (or x and y) and size (or width and height) - you cannot use pos_hint or size_hint, as those are only handled by layouts.

<CustomButton@Button>:
    image_source: ''
    subtext: ''
    GridLayout:
        height: self.parent.height  # match the button's height
        width: 100                  # set to whatever you would like
        pos: self.parent.pos        # match the button's position
        cols: 1
        Image:
            source: root.image_source
        Label:
            text: root.subtext
Factory
from kivy.factory import Factory

Then, in your loop:

for i in range(3):
    btn = Factory.CustomButton(text=str(i), size_hint=(1, None),
                               image_source='kivy.png', subtext='label')
    grid.add_widget(btn)

Finally, a side note: you're creating new bindings on grid_l every time search_btn_pressed() is called. These bindings should only be created once. You could bind once in Python by moving those bindings to HomeScreen.__init__(), but again, this is easier in kv:

GridLayout:
        id: gridlayoutID
        cols: 1
        size_hint: 1, None
        row_default_height: 40
        row_force_default: False
        height: self.minimum_height   # bind height to minimum_height
        width: self.minimum_width     # bind width to minimum_width

android - KIVY : Image + Label inside dynamic buttons - Stack Overflow

android python kivy