小编Eri*_*mpo的帖子

Xamarin在景观上形成堆栈布局填充屏幕

当设备处于“横向”模式时,如何将所有屏幕宽度都覆盖在堆栈布局中? 在横向模式下stacklayout不会填充父级

这是我的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:ListView"
         x:Class="ListView.MainPage">
<ContentPage.Content>
        <AbsoluteLayout BackgroundColor="Silver" HorizontalOptions="FillAndExpand">
        <StackLayout Orientation="Vertical" HorizontalOptions="StartAndExpand" BackgroundColor="Maroon" VerticalOptions="StartAndExpand">
            <Button Text="Reload data" Clicked="reloadData" x:Name="btnReload"/>
            <ListView x:Name="listView">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout BackgroundColor="#eee" Orientation="Vertical">
                                <StackLayout Orientation="Horizontal"  VerticalOptions="FillAndExpand">
                                    <Image Source="{Binding Imagen}" HeightRequest="100" WidthRequest="120"/>
                                    <Label Text="{Binding Titulo}" TextColor="Gray"/>
                                    <Label Text="{Binding Fecha}"  HorizontalOptions="EndAndExpand"/>
                                </StackLayout>
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>
        <ActivityIndicator BackgroundColor="Green" AbsoluteLayout.LayoutBounds=".5,.5,.2,.2" AbsoluteLayout.LayoutFlags="All" Color="Blue"
                            IsRunning="True" IsVisible="False" x:Name="overlay"/>
    </AbsoluteLayout>
</ContentPage.Content>
Run Code Online (Sandbox Code Playgroud)

我希望stacklayout在横向上采用屏幕宽度;但只有肖像才能工作。

xaml xamarin.forms

3
推荐指数
1
解决办法
2799
查看次数

在原始模式下使用termion时如何创建新行?

我正在使用termion crate来捕获用户输入键,termion::raw::IntoRawMode就像事件监听器一样.我无法在控制台中打印新行,因为stdout处于"原始模式"并且\n无法识别为新行.我不知道如何在draw_user调用方法时禁用原始模式,然后返回原始模式以便再次侦听键事件.

第二行以白色空格开头,但我不知道为什么:

在此输入图像描述

这是我的代码:

extern crate termion;

use termion::event::Key;
use termion::input::TermRead;
use termion::raw::IntoRawMode;
use std::io::{stdin, stdout, Write};

fn main() {
    let mut x: u16 = 1;
    let mut y: u16 = 1;
    // Get the standard input stream.
    let stdin = stdin();
    // Get the standard output stream and go to raw mode.
    let mut stdout = stdout().into_raw_mode().unwrap();
    write!(
        stdout,
        "{}{}{}",
        // Clear the screen.
        termion::clear::All,
        // Goto (1,1).
        termion::cursor::Goto(1, 1),
        // …
Run Code Online (Sandbox Code Playgroud)

console stdout rust

1
推荐指数
1
解决办法
761
查看次数

标签 统计

console ×1

rust ×1

stdout ×1

xamarin.forms ×1

xaml ×1