我正在尝试将 png 图像放入我的 html 正文中。挑战在于我的背景是灰色的(现在,但可能会改变),而应该是透明的 png 背景是白色的。如何告诉 html 将图像视为 png 而不是常规图像?我可以将它设置为透明还是必须指定背景颜色(如果我改变背景,透明将是理想的)?

我的代码目前是
<img src="{% static 'livestream/images/streamON.png' %}" alt="on" width="300" height="300">
Run Code Online (Sandbox Code Playgroud) Bitmap tmp = new Bitmap(1000, 1000);
Graphics g = Graphics.FromImage(tmp);
Image img = Bitmap.FromFile(LoadPath);
Image img2 = Bitmap.FromFile(TempPath);
g.DrawImage(img, 0, 0);
g.DrawImage(img2, 250, 250);
Run Code Online (Sandbox Code Playgroud)
'img' 和 'img2' 是带有透明部分的图像。当我运行代码时,透明部分显示为黑色。这是为什么?
我在布局中有一个 textview,我将单击侦听器设置为布局,并且在按下布局时更改了布局的颜色。但是我想将 textview 的背景设置为透明,但它不能。它采用窗口的背景(窗口的背景是灰色的,我的布局的背景是白色的)而不是布局的背景。
<LinearLayout android:layout_width="match_parent"
android:layout_height="50dp"
style="@style/TestLayout">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:text="Test"
android:background="@android:color/transparent"/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
在 styles.xml
<style name="TestLayout" parent="AppTheme.NoActionBar">
<item name="android:background">@drawable/selector_test_small_layout</item>
</style>
Run Code Online (Sandbox Code Playgroud)
在 selector_test_small_layout
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_pressed="true" android:state_enabled="true"
android:drawable="@drawable/s_pressed_layout" />
<item android:state_hovered="true" android:state_enabled="true"
android:drawable="@drawable/s_pressed_layout"/>
<item android:state_enabled="true" android:drawable="@drawable/s_color_primary"/>
<item android:state_enabled="false" android:drawable="@drawable/s_color_primary"/>
</selector>
Run Code Online (Sandbox Code Playgroud)
更新:抱歉我的 xml 不够完整。明天我会正确更新它 Y_Y。现在我没有源代码,只有图片
更新:我在styles.xml 中包含了更多内容
<style name="AppTheme" parent="Theme.AppCompat.Light">
<item name="android:windowContentOverlay">@null</item>
<item name="colorPrimary">@color/colorPrimary</item>
**<item name="android:windowBackground">@color/setting_divider</item>**
</style>
Run Code Online (Sandbox Code Playgroud)
在 AndroidManifest.xml 中
<application
android:name=".TestApplication"
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:largeHeap="true"
android:supportsRtl="true"
**android:theme="@style/AppTheme**">
....
</application>
Run Code Online (Sandbox Code Playgroud) 我的图像有透明的角,如图标。但是,如何为非方形标签设置盒形阴影?我想要一个跟随当前图像形状的阴影。是否有任何CSS解决方案?
我想在全屏上添加一些控件和信息QVideoWidget。因此,我创建一个QMainWindowui,然后将中央小部件提升为QVideoWidget:

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>VideoScreen</class>
<widget class="QMainWindow" name="VideoScreen">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<widget class="QVideoWidget" name="videoScreen">
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
</widget>
<customwidgets>
<customwidget>
<class>QVideoWidget</class>
<extends>QWidget</extends>
<header>QVideoWidget</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
Run Code Online (Sandbox Code Playgroud)
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ControlBoard</class>
<widget class="QWidget" name="ControlBoard">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1044</width>
<height>520</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property> …Run Code Online (Sandbox Code Playgroud) 我想在 WinForm 中的另一张图片上方显示一个透明的动画 gif 图片。
但问题是动画 gif 图像不透明且具有白色背景。
我怎样才能使gif动画透明?
这是我的橙色照片:
这是加载后我的 winform :
如您所见,Loading...图像具有白色背景。
我怎样才能透明它?
当我运行我的程序时,会JFrame显示其中的内容JFrame以及JFrame打开时的内容.

public class ChuckysAdventure extends JFrame { // Main Class
public ChuckysAdventure(){
setTitle("Chuckys Adventure");
setSize(700, 700);
setResizable(false);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public void paint (Graphics g){
g.drawString("Hi. I'm Chucky. Wanna play?", 250, 250);
}
public static void main(String[] args){ // Starts game
new ChuckysAdventure();
}
Run Code Online (Sandbox Code Playgroud) 如果我有:
<Grid Background="LightGray" Margin="2,4,2,4" Opacity="0.5">
<Image Source="{Binding FullName}" Width="300" Height="170" />
</Grid>
Run Code Online (Sandbox Code Playgroud)
这也将使图像的不透明度为0.5.当图像保持不透明度为1时,是否可以使背景透明
关于Delphi XE的快速问题.
我正在尝试制作具有透明背景的自定义圆形组件,以便在添加到表单上时,组件可以与其他组件重叠.我已经尝试过Brush.Style:=bsTransparent;或者ellipse()更多...但仍然无法找到使边缘区域透明的方法.
反正我是否可以在不使用其他lib或api的情况下使组件的边缘区域透明?
transparent ×10
c# ×3
background ×2
gif ×2
html ×2
png ×2
android ×1
bitmap ×1
box-shadow ×1
components ×1
css ×1
delphi ×1
django ×1
graphics ×1
image ×1
java ×1
jframe ×1
jpeg ×1
picturebox ×1
qt ×1
qt5 ×1
qvideowidget ×1
shadow ×1
shape ×1
swing ×1
textview ×1
winforms ×1
wpf ×1