图像在新的xaml从图像的griview xamarin表单



image in new xaml from images of a griview xamarin forms

我想在新的xaml中打开网格图像,下面是简单而好的代码:我知道它很简单,使用意图,但我在论坛上找不到任何东西,有人能帮助吗?在xaml

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:XamarinRocket.ViewModel;assembly=XamarinRocket" x:DataType="local:XamarinRocket2ViewModel"
x:Class="XamarinRocket.Views.XamarinRocket2Page">

<ContentPage.Resources>
<Style TargetType="Grid">
<Setter Property="ColumnSpacing" Value="0" />
<Setter Property="RowSpacing" Value="0" />
</Style>
</ContentPage.Resources>

<!--    DICA 2    -->

<ContentPage.Content>
<Grid>

<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<local:PinchToZoomContainer>
<local:PinchToZoomContainer.Content>
<StackLayout >
<Image Source="luciferc.jpg" />
<Image Source="luciferc.jpg" Grid.Row="0" Grid.Column="1" />
<Image Source="luciferc.jpg" Grid.Row="1" Grid.Column="0" />
<Image Source="luciferc.jpg" Grid.Row="1" Grid.Column="1" />
<Image Source="luciferc.jpg" Grid.Row="0" Grid.Column="2" />
<Image Source="luciferc.jpg" Grid.Row="1" Grid.Column="2" />
</StackLayout>
</local:PinchToZoomContainer.Content>
</local:PinchToZoomContainer>

</Grid>
</ContentPage.Content>


</ContentPage>
in cs
using System;
using System.Collections.Generic;
using Xamarin.Forms;
using XamarinRocket.ViewModel;
namespace XamarinRocket.Views
{
public partial class XamarinRocket2Page : ContentPage
{
public XamarinRocket2Page()
{
InitializeComponent();

}
}
}

我知道它很容易和使用意图,但我在论坛上找不到任何东西,有人能帮助吗?

我开始使用它:

<StackLayout >
<ImageButton  Source="luciferc.jpg" x:Name="Button666"
Clicked="ButtonClicked"/>
<ImageButton Source="luciferc.jpg" Grid.Row="0" Grid.Column="1" Clicked="ButtonClicked1"/>
<ImageButton Source="luciferc.jpg" Grid.Row="0" Grid.Column="1" Clicked="ButtonClicked2"/>
<ImageButton Source="luciferc.jpg" Grid.Row="1" Grid.Column="0" Clicked="ButtonClicked3"/>
<ImageButton Source="luciferc.jpg" Grid.Row="1" Grid.Column="1" Clicked="ButtonClicked4"/>
<ImageButton Source="luciferc.jpg" Grid.Row="0" Grid.Column="2" Clicked="ButtonClicked5"/>

</StackLayout>
public async void ButtonClicked(object sender, EventArgs e)
{
await Application.Current.MainPage.Navigation.PushAsync(new HomePage());
}
public async void ButtonClicked1(object sender, EventArgs e)
{
await Application.Current.MainPage.Navigation.PushAsync(new HomePage());
}
public async void ButtonClicked2(object sender, EventArgs e)
{
await Application.Current.MainPage.Navigation.PushAsync(new HomePage());
}
public async void ButtonClicked3(object sender, EventArgs e)
{
await Application.Current.MainPage.Navigation.PushAsync(new HomePage());
}
public async void ButtonClicked4(object sender, EventArgs e)
{
await Application.Current.MainPage.Navigation.PushAsync(new HomePage());
}
public async void ButtonClicked5(object sender, EventArgs e)
{
await Application.Current.MainPage.Navigation.PushAsync(new HomePage());
}

然而它是大量的xaml和脏,我想一个完整的屏幕这样:

如何在全屏显示选定的网格图像

package com.td.gridview;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
public class FullImageActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.full_image);

// get intent data
Intent i = getIntent();

// Selected image id
int position = i.getExtras().getInt("id");
ImageAdapter imageAdapter = new ImageAdapter(this);

ImageView imageView = (ImageView) findViewById(R.id.full_image_view);
imageView.setImageResource(imageAdapter.mThumbIds[position]);
}

}

最新更新