相关疑难解决方法(0)

六角透明的颜色

我正在为我的应用程序小部件实现一个小部件透明度选项,尽管我在修复十六进制颜色值时遇到了一些麻烦.作为十六进制颜色透明度的全新,我搜索了一下,虽然我找不到我的问题的具体答案.

我想用十六进制颜色设置透明度,所以让我说我的十六进制颜色ID"#33b5e5",我希望它是50%透明.然后我会使用"#8033b5e5",因为80%是50%.

我在这里找到了一个有用的图表:http://www.dtp-aus.com/hexadeci.htm.有了这些数据,我设法得到了这个:

0% = #00
10% = #16
20% = #32
30% = #48
40% = #64
50% = #80
60% = #96
70% = #112
80% = #128
90% = #144
Run Code Online (Sandbox Code Playgroud)

现在,当我以十六进制高于100时问题开始出现.十六进制颜色代码只能长8个符号吗?例如#11233b5e5(80%)崩溃.

我能做些什么才能让我使用更高的数字呢?

transparency android hex colors

1219
推荐指数
7
解决办法
93万
查看次数

如何在Android中使自定义视图透明

我是Android的初学者,我有一个相当简单的问题。我创建了一个自定义视图,然后通过xml将其注入到另一个布局中。我想使此自定义视图的背景透明。

我的自定义视图的xml注入:

<com.sagar.utils.ConnectDotsView
                android:id="@+id/connect_dots_view"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />
Run Code Online (Sandbox Code Playgroud)

这是自定义视图的代码:

public class ConnectDotsView extends View {

    private Bitmap mBitmap;
    private Canvas mCanvas;
    private Path mPath;
    private Paint mPaint;
    private static final int TOUCH_TOLERANCE_DP = 24;
    private static final int BACKGROUND = 0xFFDDDDDD;
    // Points to be connected.
    private List<Point> mPoints = new ArrayList<>();
    private int mLastPointIndex = 0;
    private int mTouchTolerance;
    private boolean isPathStarted = false;
    CompleteListener completeListener;

    public ConnectDotsView(Context context) {
        super(context);
        mCanvas = new Canvas();
        mPath = new Path();
        initPaint(); …
Run Code Online (Sandbox Code Playgroud)

android

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

有透明色码吗?

我正在寻找我的 actionBar 是透明的。我只有 searchView 并且它在我的 MapActivity 中,我只希望 searchView 和“后退”按钮可见。我使用哪个透明度 # 代码填写以下内容:

 getSupportActionBar().setBackgroundDrawable(new ColorDrawable(parseColor("#")));  
Run Code Online (Sandbox Code Playgroud)

transparency android background-color color-codes android-drawable

-3
推荐指数
1
解决办法
2万
查看次数