How to prevent TextView from being truncated - java

I have a TextView above a listView, and once the listView reaches the same height as the screen,(the moment some of the list items need to be scrolled-to to be seen) the text view turns into "..."
is there any way to prevent this from happening?
EDIT:
well, this is embarrassing...
the problem was that the server was returning '...' instead of the proper string, sorry for the inconvenience!

your question is no clear. i use recycler view hope this code will help you
<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:layout_width="match_parent"
android:background="#color/color_white"
android:layout_height="match_parent"
tools:context=".AffectedCountries">
<TextView
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_margin="10dp"
android:text="search"
android:textSize="40dp"
/>
<androidx.recyclerview.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/edtSearch"
android:layout_margin="5dp"
android:padding="5dp"
android:id="#+id/recyclerAffectedCountries">
</androidx.recyclerview.widget.RecyclerView>
</RelativeLayout>

Related

How to get a whole screen in an activity to scroll when a scrollable recyclerView imakes up only half of the phone screen

I want my whole screen to scroll but only my recycler will scroll at the moment. This occurs despite all elements being placed in a linear layout inside a Scroll View.
Any ideas where the error is? Here's the relevant code.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".NoodleDetailActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="#+id/noodleImage"
android:layout_width="match_parent"
android:layout_height="200dp"
android:adjustViewBounds="false"
android:scaleType="centerCrop"
app:srcCompat="#mipmap/ic_launcher" />
<TextView
android:id="#+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#drawable/border_bottom"
android:fontFamily="sans-serif-smallcaps"
android:hapticFeedbackEnabled="false"
android:padding="30dp"
android:text="TextView"
android:textSize="18sp" />
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/extras_recycler"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:background="#F2F2F2"
android:padding="0dp" />
</LinearLayout>
</ScrollView>
</androidx.constraintlayout.widget.ConstraintLayout>
This is what it looks visually.
demo appearance
Found out: it seems best practice is to set the recyclerView to be the whole layout and make it contain multiple view types.
I won't be using a nested scroll view.

Combine scrolling of Horizontal recyclerview which is inside Vertical RecyclerAdapter

Here parent having vertical recyclerview scroll and child having horizontal recyclerview ,I just wants to scroll all child together not individually currently child scrolling individually that’s a problem I am facing .I hope I explained well .If anyone have some suggestion or solution please provide I shall be really thankful to you.Check attached image
`
Parent view
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="#+id/appointments_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="#dimen/_10ssp"
android:paddingRight="#dimen/_10ssp">
</android.support.v7.widget.RecyclerView>
</RelativeLayout>
Adapter View containing horizontal recyclerview.
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.app.barber.views.CustomTextView
android:id="#+id/time_slot"
android:layout_width="#dimen/_40ssp"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:paddingTop="#dimen/_2sdp"
android:paddingRight="#dimen/_2sdp"
android:paddingBottom="#dimen/_2sdp"
android:text="9:00 AM"
android:textSize="#dimen/_10ssp"
android:textStyle="bold" />
<View
android:layout_width="0.001sp"
android:layout_height="match_parent"
android:background="#color/color_light_grey_blue" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.RecyclerView
android:id="#+id/days_recyclar"
android:layout_width="#dimen/_500sdp"
android:layout_height="wrap_content"
android:visibility="visible" />
</LinearLayout>
</LinearLayout>

GridView item height is mismatched with other

I am using a grid view. It shows issue in some devices. One item of the grid view looks shorter in height than others.
It looks like this in some devices, and in some its fine.
Layout :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:background="#android:color/white"
android:layout_height="match_parent">
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">
<LinearLayout android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.admin.fueloneApp.MainDriver"
tools:showIn="#layout/app_bar_main"
android:weightSum="8">
<TextView
android:id="#+id/main_welcome"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="#dimen/dimen_20dp"
android:text="#string/welcome"
android:textColor="#color/colorPrimary"
android:textStyle="bold" />
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/gridviewMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginBottom="#dimen/dimen_40dp"
android:layout_marginLeft="#dimen/dimen_40dp"
android:layout_marginRight="#dimen/dimen_40dp"
android:columnWidth="80dp"
android:horizontalSpacing="#dimen/dimen_10dp"
android:numColumns="2"
android:stretchMode="columnWidth"
android:verticalSpacing="10dp"></GridView>
</LinearLayout>
</ScrollView>
<TextView
android:id="#+id/textView20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_centerInParent="false"
android:text="For Any Queries Related To Mobile App Click On Service Request"
android:textAlignment="center" />
</RelativeLayout>
Item layout
EDIT : Added item layout of the grid view.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/single_grid"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/colorPrimary1"
android:orientation="vertical">
<ImageView
android:id="#+id/gris_img"
android:layout_gravity="center"
android:layout_width="80dp"
android:scaleType="fitXY"
android:layout_height="100dp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/grid_cat"
android:textSize="15sp"
android:textColor="#color/divider_color"
android:gravity="center"/>
</LinearLayout>
How can I manage the height of each item? What is the solution for this? Please help. thank you...
Gridview is having a tendency to adjust the height of all element with the tallest element in all. Hence this behaviour you are seeing.You can use StaggeredGridView.
i think your grid layout cell height is wrap_content. this problem same occur with me . change your layout height wrap_content to match_parent.
android:layout_height="match_parent"
for better solution please update your grid view item layout cell here.
Add Textview property :
android:maxLines="1"
android:singleLine="true"
if text not visible single line, you need change textview to autosizing-textview
enter link description here

ImageView Not Working Without a SetValue

This may be a stupid question but actually I do not think it is.
I am getting pictures from Firebase and my problem is that I am facing problem to display it without setting a Number to width or Height. For instance, I cannot see the image in my phone by using these lines of codes
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
or with this one
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
However, if I set a real Number to layout_width or layout_height, I am able to see the picture. For instance,
android:layout_width="wrap_content"
android:layout_height="320dp"
android:adjustViewBounds="true"
Anyone can help me to solve it. Why using wrap_content or Match_parent is not working?
Edit: my Current Layout
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
app:cardCornerRadius="5dp"
app:cardElevation="2dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:id="#+id/gridViewImagee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
/>
</LinearLayout>
By the way I am CoordinateLayout which has a Width and height of match_parent. My RecyclerView Item is located here:
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.v7.widget.RecyclerView
android:id="#+id/recyclerViewSingleProf"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.NestedScrollView>

How to overcome this problem with using more listviews in a layout

I'm using 4 listviews in my layout and if i use scrollview , i cannot scroll into my listview. If i remove scrollview in my xml, then the last list is been hiddden. How to overcome this problem?
My code goes below:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:id="#id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="42.0dip">
<Button android:textSize="23.0dip" android:onClick="newtodo_Click" android:textStyle="bold" android:textColor="#ffffffff" android:gravity="center" android:id="#id/btnNewTodo" android:background="#drawable/new_todo" android:layout_width="fill_parent" android:layout_height="wrap_content" />
</LinearLayout>
<TextView android:textColor="#000000" android:layout_height="wrap_content" android:background="#FF0000" android:layout_width="match_parent" android:text="High Priority" android:id="#+id/textView1"></TextView>
<ListView android:id="#+id/lvhigh" android:cacheColorHint="#00000000" android:background="#000000" android:layout_width="match_parent" android:layout_height="175px"></ListView>
<TextView android:background="#ffff01" android:textColor="#000000" android:layout_height="wrap_content" android:layout_width="match_parent" android:text="Medium Priority" android:id="#+id/textView2"></TextView>
<ListView android:id="#+id/lvmed" android:layout_width="match_parent" android:layout_height="175px"></ListView>
<TextView android:background="#00ff01" android:textColor="#000000" android:layout_height="wrap_content" android:layout_width="match_parent" android:text="Low Priority" android:id="#+id/textView3"></TextView>
<ListView android:id="#+id/lvlow" android:layout_width="match_parent" android:layout_height="175px"></ListView>
<TextView android:background="#cccccc" android:textColor="#000000" android:layout_height="wrap_content" android:layout_width="match_parent" android:text="Incomplete Tasks" android:id="#+id/textView4"></TextView>
<ListView android:id="#+id/lvinc" android:layout_width="match_parent" android:layout_height="175px"></ListView>
</LinearLayout>
</ScrollView>
Any Help is really appreciated and thanks in advance...
In you layout there is textview and after that listview so why you not used expandable listVIew.It will help you in your problem.
Here is example of Expandable listview
Expandable Listview
Expandable Listview example
Click Here
Click Here
An simple workaround is to
Remove ScrollView
Set height of all ListView to 0
Set layout_weight property of all child to 1
To overcome, try re-factoring your UI to not include multiple scrollable objects inside of another scrollable object. This will not be reliable and will produce unexpected results (as you have found).
As the100rabh said, this is generally bad design. Normally an application will present a list of some sort to a user. Four lists for a screen that is 2-5 (~10 for tablets) inches is three too many.
please set your listview as a non scrolling container By using
ls_edu.setScrollContainer(false);
it may help to scroll the list view.

Categories

Resources