I use this tut http://www.androidhive.info/2013/07/android-expandable-list-view-tutorial/ for know how to use expanablelistview in android but i have a problem, many childviews of my form take a long text then it auto down to 2nd row. I want only single row, so i add a HorizontalScrollView to list_item.xml like this:
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/lblListItem"
android:textSize="17dp"/>
</HorizontalScrollView>
It work but each child get a scroll,..aww (i know it'll happen but got no idea)
Some solution for this issue?
Thanks
It is not cleared If u don't want to show scrollbar then try this
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/lblListItem"
android:singleLine="true"
android:textSize="17dp"/>
</HorizontalScrollView>
Related
I don't exactly know what the issue is but just to clarify on a few things:
I'm using LinearLayout
My goal is to make a text string "example" go below an EditText view and it seems that whenever I try using margins to move the views and try to center them they always end up going the opposite way from each other, do you guys have any suggestions to fix this?
you can use Relativelayout as parent Layout and position your widgets relative to each other using their id
you can put this code in your textview xml definition
layout_below:#id/the one above it
LinearLayout
Defined android:orientation:vertical, allows you to position in list form each view that you add
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="#+id/edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textAutoComplete"/>
<TextView
android:id="#+id/text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Message"/>
</LinearLayout>
RelativeLayout
Defined android:layout_below="id_view" where id_view is the id of the view that would go first
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="#+id/edit_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textAutoComplete"/>
<TextView
android:layout_below="#id/edit_text"
android:id="#+id/text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Message"/>
</RelativeLayout>
I have a TextView within a ScrollView all wrapped in a LinearLayout and the end of the TextView is getting cutoff (multiple lines).
This is the XML:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="false">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="#+id/tv_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp"
android:text=""
android:textSize="10dp"
android:layout_weight="1"
android:layout_gravity="fill_vertical" />
</ScrollView>
</LinearLayout>
The TextView is cutting off regardless of whether the pane scrolls or not and it's driving me mad! Any help?!
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">//try this
if this doesnt solve the problem then:-
also you can try using ScrollView as a parent view.No need of that Linear layout if it just contains a single child(TextView)
Update. I 'fixed' the issue by changing the type of the fragment to work as a RecyclerFragment. Which when the fragment is added to the rest of the structure stops the cut-off!
I've inherited this app mid-development and the hand-over was...finish this app and fix the bugs, so I am finding my way through wearing a blindfold!
Thanks anyway!
I want a bouncable scrollview (iPhone like) in my project. I find some articles about overscroll and use it like This class here. But i dont know how to set over scroll view as its header.
I also tried adding a view simply before my custom scroll view but it didn't work (codes at the end).
I need a view attached to scrollview how can i do this? any idea will be grateful.
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#FF8080"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<com.amix.tstsrc.MyScrollView
android:id="#+id/my_scrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#8585FF">
<TextView
android:id="#+id/help_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#android:color/white" />
</LinearLayout>
</com.amix.tstsrc.MyScrollView>
Please go through https://github.com/Larphoid/android-Overscroll-ListView. I hope this is what you are looking for.
In case you want scrollview with header where header stays and the list scrolls and bounces then try to go for listview by using addHeaderView instead of Scrollview.
I have a layout with a ListView. The list scrolls fine, but sometimes the other content on the page needs to be bigger and either the list or the other content take up too much of the screen so I need it all to scroll.
Can that be done?
Here is the layout I have so far:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<include android:id="#+id/header"
layout="#layout/header"
android:layout_height="wrap_content"
android:layout_width="fill_parent"/>
<TextView
android:id="#+id/view_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Business:"
/>
<TextView
android:id="#+id/business_privacy"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Loading..."
/>
<TextView
android:id="#+id/think"
android:layout_width="fill_parent"
android:layout_marginTop ="5dp"
android:textColor="#color/light_best_blue"
android:paddingLeft="10px"
android:layout_height="wrap_content"
android:text="Fill out each section below"
/>
<ListView
android:id="#android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#+id/label"
android:textSize="20px"
>
</ListView>
</LinearLayout>
What would be the way to make it easy for the user to be able to see both the text and the list even if the text takes up the whole screen? Can I make the text scrollable? It is especially bad in horizontal view so I think there must be some ux patters to make it play nicely.
Thanks for the advice!
1- Put textview which has a larger text in header of the list view so it get scroll with list...
or
2- put the textview in other scroll view with fixed size like 1/3 of the screen.
You could either make the content wrap, or wrap the content up using a HorizontalScrollView. Android docs on it can be found here.
I am having an issue that make me crazy
I have a listview with WebView inside. So I created a custom listview.
The WebView forbid me to click so I created a webviewclicklistener.
My problem was that when I display some images, my webviews are "shaking" as if it wants to load the image a thousand times.
In fact I discovered that the height size of some elements change like every seconds, that give a feeling of shake.
The only way I found to fix it is to give a layout:height value for my listview.
My new problem is that when I put for exemple 600dip, I have a scrollbar, but I can't look at the end of my listviews.
If I put like 1000dip, I don't have scroll bar and I can't see the end of my list neither.
Here is my layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" android:background="#drawable/woodbackground"
android:layout_weight="1">
<TextView android:background="#android:color/transparent"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:hint="Question" android:textSize="30px"></TextView>
<ScrollView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="vertical">
<WebView android:id="#+id/wvplquestion" android:layout_height="wrap_content"
android:layout_width="fill_parent"></WebView>
</ScrollView>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#android:color/transparent" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:orientation="vertical"
android:layout_weight="1">
<TextView android:background="#android:color/transparent"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:hint="Select Answer" android:textSize="30px"></TextView>
<ListView android:id="#+id/lvquestion" android:layout_width="fill_parent"
android:layout_height="600dip" android:prompt="#string/selectp" />
</LinearLayout>
And my custom listview layout
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:orientation="vertical" android:padding="3dip">
<WebView android:id="#+id/weblistview" android:layout_width="fill_parent"
android:layout_height="wrap_content"></WebView>
Thanks for your help
maybe you can try to change your listview layout height. Instead of wrap content, put a fixed height. I don't know if it will be working, but you can try it. I'd a problem similar to yours and I solved it like this.
I hope it will work. Good luck ;)
Seems it mostly happens when several webviews contained into one scrollview. Seems at least first webviews should have fixed height.