Scrolling inside selected Item of a ListView
Tag : chash , By : pjkinney
Date : March 29 2020, 07:55 AM
should help you out You question is not very clear, but if you are saying that your ListView scrolls using whole items and that you want it to scroll using pixels instead, then please see the ScrollViewer.CanContentScroll property page on MSDN. If that is the case, then you just need to set this Attached Property to False on your ListView to enable smooth scrolling: <ListView ScrollViewer.CanContentScroll="False" ... />
|
Reuse of UICollectionViewCells during scrolling
Date : March 29 2020, 07:55 AM
I hope this helps you . I'm having an issue, , I see several potential issues: // solve problem 2
[self.collectionView registerClass:[UICollectionViewCell class] forReuseIdentifer:@"FlickrCell"];
UICollectionViewCell *cell = [cv dequeueReusableCellWithReuseIdentifier:@"FlickrCell" forIndexPath:indexPath];
cell.backgroundColor = [self generateRandomUIColor];
// solve problem 1 by looking in the contentView for your subview (and looping instead of assuming at 0)
PFImageView *pfImageView = nil;
for (UIView *subview in cell.contentView.subviews)
{
if ([subview isKindOfClass:[PFImageView class]])
{
pfImageView = (PFImageView *)subview;
break;
}
}
NSURL *staticPhotoURL = [self.context photoSourceURLFromDictionary:[self.photos objectAtIndex:indexPath.row] size:OFFlickrSmallSize];
if (pfImageView == nil)
{
// No PFImageView, create one
// note the use of contentView!
pfImageView = [[PFImageView alloc] initWithFrame:CGRectMake(0, 0, cell.contentView.frame.size.height, cell.frame.size.width) andImageURL:staticPhotoURL andOwningCell:cell.contentView];
[cell.contentView addSubview:pfImageView];
}
else
{
// Already have recycled view.
// need to reset the url for the pfImageView. (Problem 3)
// not sure what PFImageView looks like so this is an e.g. I'd probably remove the
// URL loading from the ctr above and instead have a function that loads the
// image. Then, you could do this outside of the if, regardless of whether you had
// to alloc the child view or not.
[pfImageView loadImageWithUrl:staticPhotoURL];
// if you really only have 200 static images, you might consider caching all of them
}
return cell;
|
Prevent scrolling on last item of panorama item or pivot item wp7 c#
Tag : chash , By : Rb.Ridge
Date : March 29 2020, 07:55 AM
wish of those help I'm not sure if that would work, hence as Ulugbek Umirov said in comments - it is dependant on OS version. I don't have emulator right now to try, but you may try to do it like this: public MainPage()
{
InitializeComponent();
myPivot.IsHitTestVisible = false; // disable your Pivot
Touch.FrameReported += Touch_FrameReported;
TouchPanel.EnabledGestures = GestureType.HorizontalDrag;
}
TouchPoint first;
private const int detectRightGesture = 20;
private void Touch_FrameReported(object sender, TouchFrameEventArgs e)
{
TouchPoint mainTouch = e.GetPrimaryTouchPoint(this);
if (mainTouch.Action == TouchAction.Down)
first = mainTouch;
else if (mainTouch.Action == TouchAction.Up && TouchPanel.IsGestureAvailable)
{
if (mainTouch.Position.X - first.Position.X < -detectRightGesture)
{
if (myPivot.SelectedIndex < myPivot.Items.Count - 1)
myPivot.SelectedIndex++;
}
else if (mainTouch.Position.X - first.Position.X > detectRightGesture)
{
if (myPivot.SelectedIndex > 0)
myPivot.SelectedIndex--;
}
}
}
|
UICollectioView issues with reuse cell and scrolling
Date : March 29 2020, 07:55 AM
seems to work fine You actually should store progress for each item somewhere, because when cell is reused, it will be lost and never restored. For example, make a NSMutableArray *_downloadProgressArray for that and adjust your methods accordingly: - (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
MyCell *cell = (MyCell*)[cv dequeueReusableCellWithReuseIdentifier:@"MyCell" forIndexPath:indexPath];
cell.labelTitle.text = [_editionNameArray objectAtIndex:indexPath.row];
cell.labelIssue.text = [[[_editionDescriptionArray objectAtIndex:indexPath.row]
stringByReplacingOccurrencesOfString:@"+" withString:@" "]
stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSNumber* progress = [_downloadProgressArray objectAtIndex:indexPath.row];
if (progress == nil) {
// download not started
cell.issueButton.hidden = NO;
cell.issueButton.tag = indexPath.row;
[cell.issueButton setTitle:@"Download" forState:UIControlStateNormal]; //once the download is completed set the title as Read.
[cell.issueButton addTarget:self action:@selector(downloadTheIssue:) forControlEvents:UIControlEventTouchUpInside];
cell.progressView.hidden = YES;
} else {
cell.issueButton.hidden = YES;
cell.progressView.hidden = NO;
cell.progressView.progress = progress.doubleValue;
}
cell.tag = indexPath.row;
return cell;
}
- (void)downloadManager:(DownloadManager *)downloadManager downloadDidReceiveData:(Download *)download
{
_downloadProgressArray[download.tag] = [NSNumber numberWithDouble:(your progress here)];
[self updateProgressViewForIndexPath:[NSIndexPath indexPathForRow:download.tag inSection:0] download:download];
}
|
Inside a DialogFragment the RecyclerView item width shrink before scrolling
Date : March 29 2020, 07:55 AM
Hope this helps May be it's a bug of ConstaintLayout. I updated my DialogFragment XML root with LinearLayout instead of ConstraintLayout. And it solved the shrinking problem. <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@color/colorPrimary">
<TextView
android:id="@+id/toolbarTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/check_in_information"
android:textColor="@color/white"
android:textSize="18sp" />
</android.support.v7.widget.Toolbar>
<android.support.v7.widget.RecyclerView
android:id="@+id/studyListRecyclerView"
android:layout_width="match_parent"
android:layout_height="250dp"
app:layout_constraintTop_toBottomOf="@id/toolbar"
app:layout_constraintBottom_toTopOf="@+id/closeButton"
android:layout_marginBottom="16dp">
</android.support.v7.widget.RecyclerView>
<Button
android:id="@+id/closeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/custom_button"
android:textColor="@color/buttonTextColor"
android:text="@string/close"
android:layout_marginBottom="8dp"
android:layout_gravity="center"/>
</LinearLayout>
|