I have an EditText multiline that displays a scrollbar when max lines are reached inside a ScrollView. When I try to scroll the EditText scrollbar, the ScrollView is scrolled instead, making it impossible for the user to use the EditText scrollbar. Is there a way to make is possible ?
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="#+id/careInformation"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:hint="More information"
android:inputType="textMultiLine"
android:scrollbars="vertical"
android:maxLines="5"
android:minLines="1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
Using Nested scroll view seems like a good answer. It gives focus when you touch it and removes it when you touch any other scrollable view.
Related
I am trying to create a simple chat in nativescript-angular. On Android everything works fine, however on IOS I have this strange bug, where if the user inputs multiple lines into the textview, the textview does not return to the original state, after the message was sent.
The height of the textview is set to "auto", which is needed to have dynamic sizing for the Textview.
When the user clicks the "send" button, the textview should resize to the original size. However it stays the old height. On Android the TextView resizes perfectly..
This is my TextView:
<TextView #textView row="1" column="0" textWrap="true" lineHeight="4" height="auto"
[(text)]="message" (textChange)="onTextChange($event)" class="text-view" ></TextView>
And in my typescript i just set this.message = ''; which works fine enough on Android.
Any suggestions on how to make the TextView resize on IOS? I tried it with accessing the native element and set the height to auto again:
this.textView.nativeElement.height = "auto";
height is a PercentLength Property, and auto is a valid value, however it has no impact. It works if i set it to an absolute number, but I want to avoid that.
Thanks!
iOS doesn't re-layout upon text change, you may force re-layout with following code.
this.textView.nativeElement.requestLayout();
In XML with attachments NeastedScrollView put him in LinearLayout but LinearLayout telescope ImageVew and underneath RecyclerView.
Thing is when you start something LINKS RecyclerView focuses on the full screen scrolling Upper ImageVew up. RecyclerView automatically starts with a need to with beginning begins with pictures.
<android.support.v4.widget.NestedScrollView
<LinearLayout
<ImgeView
<android.support.v7.widget.RecyclerView
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
<android.support.v4.widget.NestedScrollView
<LinearLayout android:descendantFocusability="blocksDescendants"
<ImgeView
<android.support.v7.widget.RecyclerView
</LinearLayout>
I have a very simple Xamarin.Forms app. The Xaml is a Grid with one column, and two rows. The first row contains an Entry control. The second row contains a Scrollview, which contains an Editor control (multiline text box). The second row's height is *. The Scrollview VerticalOptions is set to FillAndExpand.
The Editor needs to scroll when it fills up. The first Entry should stay where it is.
On Android the Editor control works as expected, it scrolls when it gets full up. But on iOS, as soon as the keyboard pops up, the Editor scrolls up, taking the cursor up out of sight. It also scrolls up when it only has a few lines of text in it, so they disappear. This behavior occurs on the iPhone simulator, and on a physical device.
I have tried all combinations of verticaloptions on the Scrollview, the grid, and the entry control. Nothing stops the unwanted scrolling.
I can't put a ScrollView round the whole grid because I need that first Entry to stay visible.
I cannot add pictures on this site yet, so here is a link to the layout:
image link
The garish colours are just so I can see where each control begins an ends.
I am using the latest version of everything as of Jan 2016.
<Grid Padding="5,5,5,5" RowSpacing="5" VerticalOptions="FillAndExpand" HorizontalOptions="FillAndExpand" BackgroundColor="White" >
<!--One colum-->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!--- 2 rows (0-1). 0=title, 1=body-->
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- row 0 Title -->
<Entry x:Name="txtTitle" Grid.Row="0" Grid.Column="0" BackgroundColor="Gray" TextColor="Black" />
<!-- row 1 Editor -->
<ScrollView Grid.Row="1" Grid.Column="0" BackgroundColor="Red" Padding="5,5,5,5" >
<!--Making the Editor FillAndExpand makes no difference-->
<Editor x:Name="txtBody" Grid.Row="1" Grid.Column="0" BackgroundColor="Olive"/>
<!-- -->
</ScrollView>
</Grid>
Further update. I have found that the Editor control has its own scrolling. So I have removed the ScrollView around it. The problem still persists. Once the text in the Editor has more lines than the height of the Editor, you cannot scroll down to the last line in edit mode. It's fine if you only want to view the text, but as soon as you tap the screen to put it in edit mode, you cannot get to the last row. I have deployed this to an iPhone 4 (as the lowest common denominator) and taken a screen shot. See the 1111111 at the bottom of the green Editor? There is more text below that, but you cannot get to it in edit mode. The same thing happens in the Simulator, and on an iPad 3.
iPhone4 Screenshot
This seems to be a fundamental flaw with Xamarin's Editor control. Please can someone confirm is this being addressed or if there is a workaround?
How can I hide the horizontal scrollbar at the bottom of an (iframe) embedded google spreadsheet? If there is no official way, some clever css to cut off the scrollbar would also work.
The horizontal scrollbar will dissapear if you specify the range of columns you want to appear:
<iframe src="https://docs.google.com/spreadsheets/d/1B56....this will change according to your spreadsheet/pubhtml/sheet?headers=false&gid=0&range=A:C" width="300" height="350"></iframe>
Is it possible to have the text in a radio button wrap itself? For example, I have a border area to work with that's approximately 350 pixels wide and I want to position some radio buttons in there. I can do that, but when the text is long, I cannot wrap the text.
Try this:
<RadioButton Width="100" >
<RadioButton.Content>
<TextBlock Text="This is some text that is very long" TextWrapping="Wrap" />
</RadioButton.Content>
</RadioButton>