我正在制作具有拖放功能的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) 我正在使用 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)