我正在为我的应用程序小部件实现一个小部件透明度选项,尽管我在修复十六进制颜色值时遇到了一些麻烦.作为十六进制颜色透明度的全新,我搜索了一下,虽然我找不到我的问题的具体答案.
我想用十六进制颜色设置透明度,所以让我说我的十六进制颜色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%)崩溃.
我能做些什么才能让我使用更高的数字呢?
我有2个类,FirstActivity和SecondActivity.
第一项活动
Intent intent=new Intent(getApplicationContext(),SecondActivity.class);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
SecondActivity是否可以覆盖FirstActivity?即.FirstActivity变暗,SecondActivity显示在FirstActivity之上.
如果不可能进行2项不同的活动,是否可以在同一活动中对2个视图进行叠加?我希望使用对话框不是唯一的选择.
如何在Android屏幕中创建透明活动点击以关闭按钮自动关闭活动.请提供任何解决方案.
我有一个Android应用程序,我有一个形状,我有一个固体标签.
我想用上面的颜色代码使这个形状20%透明.
我该怎么做?
我有一种情况,我想添加一个与此应用程序效果相同的图像视图

正如您所注意到的,有一个 drawable 或一些隐藏在视图底部的东西,添加了一个透明的渐变。我怎样才能达到同样的效果?
我试图将#ffffff50%不透明度的(白色)背景设置 为TextView.
我尝试使用android:alpha=0.5它,但它也使文本50%透明.
我需要在白色背景下设置50%的不透明度.
我在这里找到一个教程,但不太了解.
请给我任何参考.提前致谢.
我需要能够将背景设置为完全透明.似乎以前没有人尝试过.请帮忙.
如果我正确,我们需要使framelayout背景完全透明.但这样做没有任何影响.
感谢你的所有回应,但到目前为止它们似乎都没有.
为了进一步澄清,我需要使listview下面的背景透明.
也就是说,当抽屉完全打开时.可以看到来自下面活动的部分屏幕.它显示为模糊的灰色,一些文字可见.我需要它完全可见.
我是否需要更改活动中的某些主题?
以下是完整的布局xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/navDraweLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:orientation="vertical" >
<RelativeLayout
android:id="@+id/headerLayout"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/headerBlue"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="10dp" >
<Button
android:id="@+id/drawer_btn"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentLeft="true"
android:background="@color/logoutBtnBlue"
android:onClick="drawerBtnClicked"
android:padding="5dp"
android:textColor="@color/white" />
<TextView
android:id="@+id/headerText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:text="PeepApp"
android:textColor="@color/white"
android:textSize="25dp" />
<Button
android:id="@+id/logout_btn"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:background="@color/logoutBtnBlue"
android:onClick="logoutBtnClicked"
android:padding="5dp"
android:text="Logout"
android:textColor="@color/white" />
</RelativeLayout>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:alpha="1"
android:background="@android:color/transparent"
>
<FrameLayout
android:id="@+id/content_frame"
android:alpha="0.3"
android:background="#00000000"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--
android:layout_gravity="start" tells DrawerLayout to treat
this as …Run Code Online (Sandbox Code Playgroud) 我正在编写代码,需要沿着alpha动画将视图背景从一种颜色修改为另一种颜色。
我尝试过
ObjectAnimator backgroundColorAnimator = ObjectAnimator.ofObject(stickyLayout,
"backgroundColor",
new ArgbEvaluator(),
0xFFFFFFFF,
0xff78c5f9);
Run Code Online (Sandbox Code Playgroud)
编辑:由于我们大多数人不清楚,假设我们需要使用上面提到的解决方案在搜索栏更新值上的alpha更改此颜色,但是与alpha预期的不同...任何建议吗?
我理解如何在设计视图中执行此操作,但我不确定如何基于以编程方式创建的元素创建样式.我按照教程,这里是我在的地方:
我有一个网格视图,由一个字符串数组填充,如下面的代码所示:
...
gridView = (GridView) findViewById(R.id.gridView);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, strData);
gridView.setAdapter(adapter);
Run Code Online (Sandbox Code Playgroud)
字符串数组的每个元素都可以很好地填充网格.
如何设置添加到gridView的项目的文本颜色?
android ×9
background ×1
color-codes ×1
colors ×1
gridview ×1
hex ×1
opacity ×1
overlay ×1
transparency ×1
view ×1