我想知道如何使用九个olad架构动画创建一个脉冲效果.
为了更好地理解你可以说你有一个ImageView,并希望有一个"脉冲"效果,如使图像小一点,然后回到原始大小,缩放将居中.
我使用九个olad机器人向后兼容.
欢迎任何其他选择.
谢谢.
我想使用xml为我的tabhost图标着色,而不是以编程方式进行(我无论如何都无法做到这一点)...所以我在SO上找到了这个帖子:Android imageview更改色调来模拟按钮点击
这似乎是一个非常好的解决方案,但我无法在我的项目中正确调整它......我做了以下更改:
public class TintableImageView extends ImageView {
private ColorStateList tint;
public TintableImageView(Context context) {
super(context);
}
//this is the constructor that causes the exception
public TintableImageView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context, attrs, 0);
}
public TintableImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
init(context, attrs, defStyle);
}
//here, obtainStyledAttributes was asking for an array
private void init(Context context, AttributeSet attrs, int defStyle) {
TypedArray a = context.obtainStyledAttributes(attrs, new int[]{R.styleable.TintableImageView_tint}, defStyle, 0);
tint = …Run Code Online (Sandbox Code Playgroud) ImageView有两种方法相关的方法:setAlpha和setImageAlpha.前者从API级别1开始可用,但从级别16开始不推荐使用.后者从16级开始可用.还有另一个setAlpha方法,来自View类,这是在API级别11中引入的.
ImageView#setAlpha和ImageView#setImageAlpha之间的区别仅在于命名吗?有任何行为差异吗?View#setAlpha和ImageView#setAlpha之间的关系是什么?
我有一个固定宽度和高度的单元格,让它为100x100px.在那个单元格中,我想要显示一个ImageView带边框的边框.
我的第一个想法是将背景资源放入ImageView,并添加1dp的填充以创建边框效果:
<LinearLayout
android:layout_width="100dp"
android:layout_height="100dp" >
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/image_border"
android:padding="1dp"
android:src="@drawable/test_image" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
显然这应该有效,但它没有,或者至少没有预期的那样.
问题是ImageView背景填充整个100x100px单元格的空间,因此,如果图像的宽度小于100px,则顶部和底部边框将显得更大.
注意黄色边框,我需要它在ImageView周围正好1px:

任何帮助,想法,任何建议都非常感谢.
android android-widget android-emulator android-layout android-imageview
我有一张存储在手机SD卡中的图像.我想在图像视图中显示它.我知道文件的位置.关于活动的创造是有一种简单的方式来说出类似的东西
ImageView img = (ImageView) findViewById(R.id.imageView1);
String path = Environment.getExternalStorageDirectory().toString() "Images/image.jpg";
img.setsrc = path ;
Run Code Online (Sandbox Code Playgroud)
如果有任何办法,请告诉我.谢谢.
在iOS中,准备图形很简单.有正常图像(高x宽)或视网膜图像@ 2x(高2倍×宽2倍).
但是,由于我是Android的新手,我在Eclipse中看到了大量的drawable-*文件夹,其中*可以是"hdpi"或"ldpi"或"mdpi"或"xhdpi"或"xxhdpi".有人可以非常清楚地简单地列出我必须做些什么才能满足每种显示可能性,以便我的图像在每种情况下看起来都正确吗?我想象一个答案将是一个列出每个"*"的子弹列表和一个包含必须完成的事情的子弹列表.
我也非常喜欢从最高密度和最大尺寸图像开始的答案,因为我将在Photoshop中创建并且将从主图像中降低质量.提前致谢!
android image high-resolution android-image android-imageview
这是我的xml,它位于我的活动中出现的片段内.
<FrameLayout
android:id="@+id/frame1"
android:layout_width="wrap_content"
android:layout_height="115dp"
android:layout_margin="2dp"
android:layout_weight="0.33">
<ImageView
android:id="@+id/whoamiwith"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitCenter"
android:src="@drawable/default_image" />
</FrameLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的java代码:
@Override
public void onClick(View click) {
if (click == profileBtn) {
whoamiwith.setBackgroundResource(R.drawable.image_i_wanna_put);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在尝试更改图像视图的图像源.没有语法错误但是当我单击按钮时,模拟器正在给我一个强制关闭,并且在logcat上它说:
显示java.lang.NullPointerException
它指向这条线:
whoamiwith.setBackgroundResource(R.drawable.loginbtn);
Run Code Online (Sandbox Code Playgroud) 如何给六角形ImageView.有可能以同样的方式做吗?如果是,那怎么样.如果这是不可能的,那么如何实现这一目标呢?
<shape xmlns:android="http//schemas.android.com/apk/res/android"
android:shape="hexagon">
<solid android:color="#ffffffff" />
<size android:width="60dp"
android:height="40dp" />
</shape>
Run Code Online (Sandbox Code Playgroud)

在这里我不能做掩蔽图像,因为我无法检测到我应该裁剪哪个位图部分以获得六边形形状位图.所以我正在寻找六角形的答案ImageView
我想ImageView用in 重复图像RelativeLayout.它可以是可以使用位图xml和使用TILEMODE "repeat"用RelativeLayout,因为我已经看到了在互联网上都处理事情LinearLayout.
任何帮助或提示将受到热烈欢迎.
我想把阴影应用到ImageView.当我将阴影应用于TextView我正在获得它但同样它没有达到ImageView.我怎么解决这个问题?