小编Sun*_*ana的帖子

多边形自动调整到其上面的多边形

我正在制作具有拖放功能的Windows桌面应用程序.我正在使用Polygon(和后面的图像)形状进行拖放.拖放功能工作正常,但我希望如果用户从面板拖动任何形状,当他拖动其他形状,然后第二个形状自动修复第一个形状.你可以通过下面的截图来了解它.

这是我在拖动形状时会发生什么的屏幕截图

当用户将多边形放在另一个多边形附近时,如果相同的多边形在画布的其他区域中下降而不是错误将向用户显示,则它将自动调整.

在此输入图像描述

这是我的XAML代码

<Window x:Class="Images.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Images"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <DockPanel 
        VerticalAlignment="Stretch" 
        Height="Auto">

        <DockPanel 
            HorizontalAlignment="Stretch" 
            VerticalAlignment="Stretch" 
            Height="Auto" 
            MinWidth="400"
            Margin="10">

            <GroupBox 
                DockPanel.Dock="Left" 
                Width="350" 
                Background="Aqua"
                VerticalAlignment="Stretch" 
                VerticalContentAlignment="Stretch" 
                Height="Auto">
                <WrapPanel Margin="0,10,0,0" VerticalAlignment="Top">
                    <Button Name="control" Content="Control" Height="30" Background="BlueViolet" Margin="5" Width="100"/>
                    <Button Name="motion" Content="Motion" Width="100" Margin="5" Background="Green" Height="30"/>
                    <Button Name="variable" Content="Variable" Width="100" Margin="5" Background="SeaGreen" Height="30"/>
                    <Button Name="sensor" Content="Sensor" Width="100" Margin="5" Background="OrangeRed" Height="30"/>
                    <Button Name="lcd" Content="LCD" Width="100" Margin="5" Height="30" Background="PaleVioletRed"/>
                    <Button Name="function" Content="Function" Width="100" Margin="5" Height="30" Background="Salmon"/>

                    <StackPanel Name="heaading" Width="350">
                        <TextBlock …
Run Code Online (Sandbox Code Playgroud)

c# wpf visual-studio

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

为什么notifyItemRemoved(getAdapterPosition()); 不管用

我正在使用 RecyclerView 来显示 mp3 歌曲列表。现在的问题是当我尝试删除这首歌时。这首歌已成功删除,但该项目仍保留在 RecyclerView 中,我认为它实际上重新创建了自己,我不明白它是什么。这是发生了什么的屏幕截图。 在此处输入图片说明

正如您在上面的屏幕截图中看到的那样。我尝试删除一首歌曲,但该歌曲仍保留在列表中,并且在其后面还创建了另一个列表。我不知道会发生什么。这是我的代码 SongFragment:-

@Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        activityView = inflater.inflate(R.layout.fragment_song, container, false);
//        SongsLibrary songsLibrary = new SongsLibrary();
//        songsLibrary.getSongThumnail(getActivity(), songArt);
        swipeRefreshLayout = activityView.findViewById(R.id.swiperefresh);
        if(arrayList == null){
            SongsLibrary songsLibrary = new SongsLibrary();
            songsLibrary.getSongs(getActivity());
        }
        mIntentFilter = new IntentFilter();
        mIntentFilter.addAction(deteleSong);
        setUpMusic();
        return activityView;
    }

    private void setUpMusic() {

//        todo when there is no activity and no song player than arraylist.size on null object
        RecyclerView songRecyclerView = activityView.findViewById(R.id.song_list);
        songRecyclerView.setNestedScrollingEnabled(false); …
Run Code Online (Sandbox Code Playgroud)

android android-recyclerview

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

如何在android中一次显示两个活动

我有2个活动,在第一个活动中我有一个按钮,我希望当用户点击或向上移动该按钮时,第二个活动来自底部,当它转到屏幕的一半时停止.我不明白我怎么能做到这一点.我也搜索谷歌,但他们显示了一些类型的对话框:(. 在此输入图像描述

这就是我要的.当应用程序启动第一个活动显示在屏幕上时,但当用户单击^此按钮时,两个活动在屏幕上显示50%.任何人都可以告诉我如何实现这一目标.可能吗???

android

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

标签 统计

android ×2

android-recyclerview ×1

c# ×1

visual-studio ×1

wpf ×1