我计算了一个值在 0 到 255 之间的图像。当我使用 imageview() 时,图像以灰度级正确显示,但是当我想保存此图像或使用 imshow 显示它时,我有一个白色图像,或者有时这里和那里有一些黑色像素:

而使用 imageview():

有人能帮我吗?
嗨,我用按钮覆盖了我的 ImageView,但是当它们彼此靠近时,你无法分辨它是按钮,它只是一个大红色方块。我需要一种快速简便的方法来为我的按钮设置边框/边缘或其他东西,以便您可以看到不同的按钮。
我有一个ImageView我想以编程方式设置的大小。所以我没有选择将不同大小的图像放在各自的drawable文件夹中。
基本上,我想LayoutParams根据屏幕分辨率进行设置,而不是执行我在下面所做的操作。如果设备是ldpi或mdpi,那么100,100...如果是hdpi,那么150,150等等。我怎样才能做到这一点?
ImageVIew imageView = new ImageView(this);
imageView.setLayoutParams(new ViewGroup.LayoutParams(100, 100));
layout.add(imageView);
Run Code Online (Sandbox Code Playgroud) 我想为我的 ImageView 构建一个放大和缩小动画,我设置了一个侦听器并将动画 RepeatCount 设置为无限。
首先,我从放大效果开始,然后在 onAnimationRepeat 方法中创建缩小部分,其中使用布尔值我想重新启动整个效果,开始再次放大。但是在第一次没有再次调用 onAnimationRepeat 之后,反过来动画正在重复但它卡在缩小部分。
我错过了什么?
//image animation
Animation anim = new ScaleAnimation(1.0f, 1.1f, 1.0f, 1.1f);
anim.setInterpolator(new LinearInterpolator());
anim.setRepeatCount(Animation.INFINITE);
anim.setDuration(10000);
zoomIn = true;
// Start animating the image
final ImageView splash = (ImageView) findViewById(R.id.imageView);
splash.startAnimation(anim);
anim.setAnimationListener(new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
if(zoomIn) {
Log.w("", "we zoom out, and zoomIn is: " + zoomIn);
Animation anim = new ScaleAnimation(1.1f, …Run Code Online (Sandbox Code Playgroud) 我在回收视图中有一个列表项,我想在整个元素上获得涟漪效果 - 目前我的 GIF 与涟漪重叠。我不知道如何解决这个问题,经过研究已经尝试了很多方法,但没有任何效果。
这是我构建每个列表项所基于的特定 XML 文件。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="@drawable/selector"
android:clickable="false">
<pl.droidsonroids.gif.GifTextView
android:layout_width="84dp"
android:layout_height="84dp"
android:paddingTop="3dp"
android:paddingBottom="3dp"
android:paddingRight="1dp"
android:paddingLeft="1dp"
android:background="@drawable/a_present_for_you"
/>
<TextView
android:id="@+id/textView"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:textColor="@color/black"
android:textSize="16sp"
android:gravity="center_vertical"
android:drawableRight="@drawable/ic_lock_open_blue_24dp"
android:drawablePadding="16dp">
</TextView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
这就是我要的:
[截屏]
这是我所做的:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="30dip"
android:background="@color/color"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="1dp"
android:background="@color/color"
android:orientation="horizontal">
<View
android:id="@+id/divider"
android:layout_width="5dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="@color/grey"
android:gravity="center_vertical" />
<LinearLayout
android:id="@+id/llayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/color"
android:orientation="vertical" >
<TextView
android:id="@+id/label"
style="@style/some_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="8dp"
android:gravity="left" />
<TextView
android:id="@+id/label2"
style="@style/some_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginLeft="8dp"
android:gravity="left" />
</LinearLayout>
</LinearLayout>
</merge>
Run Code Online (Sandbox Code Playgroud)
我已经完成了,但问题是如何在垂直线性布局的右上角对齐图像(可以在屏幕截图中看到)。
我也尝试过使用相对布局,图像出现在右上角,但它在文本视图中剪切了我的文本。
请建议:
我正在尝试向 ImageView 添加多个效果(超过 2 个)。2 效果没有问题:effect1.setInput(Effect effect2) and imageView.setEffect(effect1)
但是我怎样才能用 3 个或更多的效果来做到这一点?
先感谢您!
我的驱动器网址是 - https://drive.google.com/file/d/0B3DFHb2-MdGYa2NMUkVtVkZ1V1k/view?usp=sharing
我想使用 glide 在 android imageview 中显示它。我尝试了很多方法来展示它。以下是我要显示的代码 -
Glide.with(getActivity()).load(readExcelFeed.getImage().toString()).into(ivQueImage);
Run Code Online (Sandbox Code Playgroud)
请让我知道其中有什么问题。
我在assets文件夹下有8个不同的植物物种图像,我在数据库的assets目录中缓存了8个图像资产文件名(对应于路径,例如foxtail.png,orchid.png)。(加上其他信息)
我正在“在 RecyclerView 中显示 8 种植物”。单击任何植物会打开详细信息活动。(传递保存在资产文件夹中的图像文件名,例如 foxtail.png)
如何在资产文件夹中选择与传递给 Detail Activity 的文件名匹配的特定图像文件并将其设置为 ImageView?
我正在通过 Glide 从云加载图像到我的回收器视图的 ImageView。我想要的是在单击这些图像中的每一个时,图像应该全屏显示并具有捏缩放功能。谢谢