标签: stretch

css根据内容拉伸li

我在这里这段代码,我正在尝试ul.submenu li根据其内容进行拉伸。如您所见,第 3liul.submenu有一个长文本,它隐藏而不是拉伸li.

我曾尝试display使用各种组合更改DOM 上所有元素的属性,但我无法做到。

我做错了什么,为什么会发生这种情况?我错过了什么?

任何帮助将不胜感激!:)

html css stretch html-lists

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

拉伸和填充中间布局 Android

我有一个主要的相对布局(高度,宽度=填充父),里面有 3 个布局:

1st: Frame Layout(width=fill_parent/height=wrap_content)
2nd: Linear Layout(width=fill_parent/height=wrap_content/layoutbelow 1st)
3rd: Relative Layout(height=wrap_content/width=fill parent/layout_alignParentBottom="true"/ layoutbelow 2nd)
Run Code Online (Sandbox Code Playgroud)

我希望第三个布局位于屏幕底部,第一个位于屏幕顶部,第二个布局填充两者之间的空间。我该怎么做呢?我点击了这个链接:Android LinearLayout fill-the-middle并尝试设置 layout_height="0px" 和 layout_weight="1" 但它没有用。任何人都可以帮我解决这个问题吗?

谢谢

layout android autofill autosize stretch

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

Android - 制作背景图片,不要拉伸它的指定视图

万岁的照片!这是将图片分配给背景时的样子,何时不是.

在此输入图像描述

在此输入图像描述

TableView如果图像大于桌子,我非常希望它不会伸展到顶部.我已经包含了一个空的"视图",以便为表的背景提供一些额外的空间,正如您可以在XML中看到的那样.试图用ScaleType搞乱,但这是一个洗.

如何让BG伸展以适应布局?我正在尝试优雅地处理"用户xxx的屏幕小于WVGA".显然,我缺乏恩典.

<TableLayout
android:id="@+id/widget29"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:scaleType="fitXY"
android:background="@drawable/minetownx480"
>
<View
android:id="@+id/blankSpace"
android:layout_width="fill_parent"
android:layout_height="60dip" />

<TableRow android:id="@+id/widget40" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal">
    <TextView android:id="@+id/moneyText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Money: $$$$$$$$$" />
    <TextView android:layout_width="fill_parent" android:layout_height="wrap_content"  android:id="@+id/savingsText"  android:gravity="right"  android:text="Savings: $$$$$$$"  android:layout_weight="3" android:textSize="12sp"/>
</TableRow>

<TableRow android:id="@+id/widget41" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal">
    <TextView android:id="@+id/wagonText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Wagon Space: XXX/XXX" />
    <TextView android:id="@+id/loanText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Loans: $$$$$$$$" android:gravity="right" android:layout_weight="3" android:textSize="12sp"/>
</TableRow>

<TableRow android:id="@+id/widget42" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" >
    <TextView android:id="@+id/daysText" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Days Left: XX/XX" />
    <TextView …
Run Code Online (Sandbox Code Playgroud)

android background stretch tablelayout

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

旋转器扩展到屏幕边界之外

我有一个包含三行TableLayout的布局.每行都有一个TextView和一个Spinner.Spinners的专栏将设置为拉伸.我的问题是,当旋转器包含一个长弦时,它们会从屏幕边缘伸展开来.我希望他们截断字符串.这是问题的截图:

http://www.comicfanboy.net/images/screenshot.png

这是布局的xml:

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/settings_scrollview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="center_horizontal">
    <LinearLayout android:id="@+id/linearLayout1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:paddingLeft="3dp" android:paddingRight="3dp">
        <TextView android:id="@+id/textView1" android:layout_height="wrap_content" android:text="@string/general_information_defaults" android:gravity="center_horizontal" android:layout_width="fill_parent"></TextView>
        <TableLayout android:layout_height="wrap_content" android:id="@+id/tableLayout1" android:layout_width="fill_parent" android:stretchColumns="1">
            <TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content">
                <TextView android:id="@+id/textView2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="right|center_vertical" android:text="Spinner Label 1"></TextView>
                <Spinner android:layout_height="wrap_content" android:id="@+id/default_organization_spinner" android:layout_width="wrap_content"></Spinner>
            </TableRow>
            <TableRow android:id="@+id/tableRow2" android:layout_width="wrap_content" android:layout_height="wrap_content">
                <TextView android:id="@+id/TextView01" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="right|center_vertical" android:text="Spinner Label 2"></TextView>
                <Spinner android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/default_sport_spinner"></Spinner>
            </TableRow>
            <TableRow android:id="@+id/tableRow3" android:layout_width="wrap_content" android:layout_height="wrap_content">
                <TextView android:id="@+id/TextView02" android:gravity="right|center_vertical" android:layout_height="fill_parent" android:layout_width="fill_parent" android:text="Spinner Label 3"></TextView>
                <Spinner android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/default_injury_spinner"></Spinner>
            </TableRow>
        </TableLayout>
        <TextView …
Run Code Online (Sandbox Code Playgroud)

android stretch width spinner tablelayout

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

Android:"缩放到填充屏幕"和"拉伸到填充屏幕"

当我在之间切换时zoom to fill screen,stretch to fill screen我的应用程序将崩溃.顺便说一句,我注意到市场上很多应用程序都存在这个问题.有谁知道如何避免这个问题.

这是logcat:

E/AndroidRuntime(24475): FATAL EXCEPTION: main
E/AndroidRuntime(24475): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.macchetv.api/com.macchetv.activity.HomeActivity}: java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to android.widget.AbsListView$SavedState
E/AndroidRuntime(24475):        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1818)
E/AndroidRuntime(24475):        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1834)
E/AndroidRuntime(24475):        at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3191)
E/AndroidRuntime(24475):        at android.app.ActivityThread.access$600(ActivityThread.java:122)
E/AndroidRuntime(24475):        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1031)
E/AndroidRuntime(24475):        at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(24475):        at android.os.Looper.loop(Looper.java:132)
E/AndroidRuntime(24475):        at android.app.ActivityThread.main(ActivityThread.java:4126)
E/AndroidRuntime(24475):        at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(24475):        at java.lang.reflect.Method.invoke(Method.java:491)
E/AndroidRuntime(24475):        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
E/AndroidRuntime(24475):        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
E/AndroidRuntime(24475):        at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime(24475): Caused by: java.lang.ClassCastException: android.view.AbsSavedState$1 cannot be cast to …
Run Code Online (Sandbox Code Playgroud)

layout android view zoom stretch

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

ListBoxItem Horizo​​ntalContentAlignment =拉伸不起作用

我无法将列表框项目扩展到整个列表框宽度.

下面是我的列表框的xaml

<ListBox x:Name="MyListBox"
                 VerticalAlignment="Stretch"
                 HorizontalAlignment="Stretch"
                 HorizontalContentAlignment = "Stretch"
                 Margin="0,10,0,0"
                 ItemsSource="{Binding Path=Users}"
                 ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                 Grid.Column="0"
                 Grid.ColumnSpan="1"
                 Grid.Row="1"
                 Grid.RowSpan="3">                      
        <ListBox.ItemTemplate>
            <DataTemplate>
                <local:MyListBoxTemplate/>
            </DataTemplate>
        </ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)

我已尝试在其他帖子上找到以下建议,但他们没有为我工作:

  • 将ListBox的Horizo​​ntalContentAlignment设置为Stretch
  • 覆盖listboxitem的样式,即listbox xaml中ItemContainerStyle标签内的新样式(注意:我正在使用大都会导航主题)
  • 编辑CoreStyles.xaml中的DefaultListBoxItemStyle样式以包含Horizo​​ntalContentAlignmemt

是因为我正在为我的数据模板使用单独的xaml文件吗?或者我的数据模板有问题?有没有人对我还能尝试什么有任何建议?

我看到某处或许我可以将ListBoxItem Width绑定到ListBox的实际宽度?

我是新手,所以如果我错过了一些非常简单/明显的东西,我会提前道歉!

以下是我的数据模板:

<Grid x:Name="LayoutRoot" HorizontalAlignment="Stretch" ShowGridLines="True" Height="20">
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="10*" />
        <ColumnDefinition Width="30*" />
        <ColumnDefinition Width="300*" />
        <ColumnDefinition Width="50*" />
        <ColumnDefinition Width="10*" />
    </Grid.ColumnDefinitions>
    <Image x:Name="TwitterImageIcon"
           Grid.Column="1" 
           Grid.ColumnSpan="1" 
           Source="{Binding Path=imageUrl}"
          />
    <StackPanel Orientation="Horizontal" Grid.Column="2" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" >

        <TextBlock x:Name="TwitterUsernameTextBlock"
                   Text="{Binding Path=username,StringFormat='@\{0\}  '}"/>
        <TextBlock x:Name="TwitterFullNameTextBlock"
               Text="{Binding Path=fullname}"/>
    </StackPanel>


        <Button x:Name="InfoButton" …
Run Code Online (Sandbox Code Playgroud)

silverlight listbox datatemplate stretch listboxitem

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

我的画布垂直和水平延伸,但里面的图像没有

我正在创建一个弹出菜单,一个ToggleButton和一个Popup控件.所有这些都包含在画布中.以下图片位于我的应用程序的右下角.我将我的Canvas设置为在Index 1列中,拉伸2列,并在第二行到底行.

在此输入图像描述

灰色图像只是一个占位符.从下面的XAML中,您可以看到我已将所有内容设置为拉伸.Canvas延伸,但没有别的.注释掉StackPanel和/或Label什么都不做.所以我确信这两者都不是原因.ToggleButton没有拉伸到Canvas的大小.

在此输入图像描述

我做了截图,所以我可以更好地突出显示相关部分.但如果我需要粘贴代码,我可以.

编辑

更新了XAML:

<Border BorderBrush="Green" BorderThickness="1" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
            <Grid Name="ToggleButtonCanvas" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                <StackPanel Orientation="Vertical" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" >
                    <ToggleButton x:Name="btnPluginMenu" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                        <ToggleButton.Template>
                            <ControlTemplate TargetType="{x:Type ToggleButton}">
                                <Border x:Name="bdr" BorderThickness="0">
                                    <Border.Background>
                                        <ImageBrush ImageSource="< omitted >" Stretch="Fill" TileMode="None" />
                                    </Border.Background>
                                    <ContentPresenter VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="8,6,8,6" ContentSource="Content" />
                                </Border>
                            </ControlTemplate>
                        </ToggleButton.Template>
                    </ToggleButton>
                    <Label Canvas.Left="10" Canvas.Top="10" Content="Menu" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
                </StackPanel>
                <Popup Placement="Relative"  HorizontalOffset="-120" VerticalOffset="-130" PlacementTarget="{Binding ElementName=btnPluginMenu}" IsOpen="{Binding ElementName=btnPluginMenu, Path=IsChecked}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" PopupAnimation="Scroll">
                    <Grid Background="Gray">
                        <Grid.BitmapEffect> …
Run Code Online (Sandbox Code Playgroud)

wpf xaml alignment stretch vertical-alignment

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

如何制作背景附件:固定;不拉伸图像?

我想让背景图像随着使用滚动而移动,并且使用background-attachment:fixed是正常的;但问题是它正在拉伸图像,我无法再定位它。

http://jsfiddle.net/5c3b56a7/3/

.container{

    display: block;
    position: relative;
    width: 100%;
    margin:0 0 10px 0;
    padding:0;
    overflow:hidden;
    background-image:url('http://cdn.wallwuzz.com/uploads/background-fantasy-wallpaper-array-wallwuzz-hd-wallpaper-4338.jpg');
    overflow:hidden;
    background-repeat: no-repeat;
    background-position: center center;
    background-size:cover;
    min-height:350px;

}

.container2{
    background-attachment:fixed;
}
Run Code Online (Sandbox Code Playgroud)

您可以在全屏上更好地看到问题 http://jsfiddle.net/5c3b56a7/3/embedded/result/

第一张图片位于顶部中心位置

第二个由于附件而无法定位。

有什么办法可以做到这一点吗?

html css background-image stretch

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

无法在 Debian 9 (Stretch) 上安装 php 7.2

我添加了存储库以在 Debian Stretch 上安装 php 7.2。

sudo apt install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt update
Run Code Online (Sandbox Code Playgroud)

但是当我运行 apt update 时 - 我收到一个错误:

E: The repository 'https://packages.sury.org/php stretch Release' does not have a Release file.
Run Code Online (Sandbox Code Playgroud)


据我了解,问题出在我的环境中。
但无法弄清楚是什么问题。




PS:

我的/etc/apt/sources.list:

# deb http://ftp.de.debian.org/debian/ jessie main
# deb http://ftp.de.debian.org/debian/ buster main
deb http://ftp.de.debian.org/debian/ stretch main
deb http://ftp.us.debian.org/debian/ stretch main contrib non-free
deb-src http://ftp.us.debian.org/debian/ stretch main contrib non-free
deb …
Run Code Online (Sandbox Code Playgroud)

debian repository stretch php-7.2

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

我们可以在窗口上使用多个xaml布局吗?

我认为我们可以在带有XAML的窗口上使用多种布局.所以我尝试创建一个这样的窗口:我想在左边创建一个ListView,它可以调整大小.左侧的网格和文本框将适合右侧网格.我试图使用其他布局,StackPanel,DockPanel.如何创建可调整大小的网格

    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="Auto"/>
        <RowDefinition />
        <RowDefinition Height="Auto"/>
    </Grid.RowDefinitions>
    <ToolBar Name="toolBar" Grid.Row="0">
        <Button Name="btnLoad" Width="Auto" Height="25" ToolTip= Click="btnLoad_Click" VerticalAlignment="Bottom">
            <StackPanel Orientation="Horizontal">
                <Image Source="Resources/reload.png" Width="16" Height="16" HorizontalAlignment="Left" Margin="0 0 5 0"/>
                <TextBlock>Load/Reload</TextBlock>
            </StackPanel>
        </Button>
        <Button Name="btnSave" Width="Auto" Height="25"  Click="btnSave_Click">
            <StackPanel Orientation="Horizontal">
                <Image Source="Resources/save.png" Width="16" Height="16" HorizontalAlignment="Left" Margin="0 0 5 0"/>
                <TextBlock>Save</TextBlock>
            </StackPanel>
        </Button>
    </ToolBar>
    <ComboBox Name="cbTypeOfShop" Grid.Row="1" Margin="5 5 5 5"/>
    <Grid Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <ListView Grid.Column="0" VerticalAlignment="Stretch" …
Run Code Online (Sandbox Code Playgroud)

wpf xaml stretch

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

父母100%的身高.所有父母身高都是动态的

我已经阅读了大量的问题和文章,我似乎无法弄清楚这一点.

这是我的布局结构的一个粗略示例:

body  
- div 1 (header)  
- div 2 (main content wrapper)  
- - div 2a  
- - - div 2a1  
- - - div 2a2  
- - - - div 2a2a (this div needs to fit 100% height of it's parent - div 2a2)  
- - - div 2a3  
- - div 2b  
- div 3 (footer)
Run Code Online (Sandbox Code Playgroud)

我认为我的主要问题源于2a的所有子元素都向左浮动的事实.

我发现的所有答案都谈到了添加100%高度的父容器,包括html和body标签.但我不能只是通过增加高度:100%; 所有每个提升的父母,因为它最终打破了我的布局.具体来说,当我将100%的高度添加到我的主内容包装器时,div 2.

这是我制作的一个jsfiddle,很好地代表了我的问题.

html css height stretch

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