我有一个listview与覆盖getView方法来填充它.现在,我想让列表中的每个项目动画或从屏幕右侧移动到项目正常出现的左侧.
每个项目的动画不应该同时开始,它必须在其他项目移动之前延迟几毫秒...
好吧,这是我的适配器类:
public class MyAdapter extends ArrayAdapter<String>{
private Context context;
private String[] info;
public MyAdapter(Context context, int resource,
String[] objects) {
super(context, resource, objects);
// TODO Auto-generated constructor stub
this.context = context;
this.info = objects;
}
protected class RowViewHolder {
public TextView text1;
public CheckBox cb;
public String ss;
}
@Override
public View getView(int pos, View inView, ViewGroup parent) {
View vix = inView;
RowViewHolder holder;
if (vix == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
vix = inflater.inflate(R.layout.check_list, …Run Code Online (Sandbox Code Playgroud) 好的,这就是我在我的活动中有一个ImageView的问题,这是它在main.xml中的样子:
<ImageView
android:id="@+id/ic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon"
android:layout_gravity="center_horizontal"/>
Run Code Online (Sandbox Code Playgroud)
我希望这个图像移动-200(左)然后移动到100(右)然后再回到0并具有弹跳效果.
我用我的代码实现了这个:
as = new AnimationSet(true);
as.setFillEnabled(true);
as.setInterpolator(new BounceInterpolator());
TranslateAnimation ta = new TranslateAnimation(-300, 100, 0, 0);
ta.setDuration(2000);
as.addAnimation(ta);
AnimationSet sa = new AnimationSet(true);
sa.setFillEnabled(true);
sa.setInterpolator(new DecelerateInterpolator());
TranslateAnimation ta2 = new TranslateAnimation(100, 0, 0, 0);
ta2.setDuration(2000);
sa.addAnimation(ta2);
as.addAnimation(sa);
Run Code Online (Sandbox Code Playgroud)
你可以在代码中看到我想要的X转换(-300,100)然后(100,0)
然而,图像不会像它应该移动,而只是停在100然后弹跳...
嗯....你们知道出了什么问题或者我该怎么做才能做到这一点?
好的,我这里有一个简单的问题.如何更改可扩展列表视图中的组箭头与另一个drawable?我知道,我将使用+和 - 用于我的可扩展组列表...
谢谢
好的,简单的问题,但对我来说非常重要.
所以,其他Android客户端正在发送此xml消息:
<message
id='6ymdM-19'
to='xox@xox.xox/smack'
type='chat'>
<subject>normal</subject>
<received xmlns='urn:xmpp:receipts' id='HVgQw-5'/>
</message>
Run Code Online (Sandbox Code Playgroud)
我的听众大致是这样的:
private class MsgListener implements ChatStateListener {
/**
* Constructor.
*/
public MsgListener() {
}
@Override
public void processMessage(Chat chat, org.jivesoftware.smack.packet.Message message) {
String xmlMessage = message.toXML();
Log.v(TAG, "XML Chat: "+xmlMessage);
// getExtension namespace try urn:xmpp:receipts
if(xmlMessage.contains("<request xmlns=")) {
Log.d(TAG, "new chat message arrive! reply with RECEIVED!");
replyReceived(message);
} else if(xmlMessage.contains("<received xmlns=")) {
Log.d(TAG, "RECEIVED notification arrived!");
PacketExtension statusExtension =
message.getExtension("urn:xmpp:receipts");
Log.d(TAG, "Extension name: "+statusExtension.getElementName());
Log.d(TAG, "Extension XML: "+statusExtension.toXML()); …Run Code Online (Sandbox Code Playgroud) 这是我的代码......
String[] show = new String[2];
RemoteViews remoteViews;
public static String ACTION_WIDGET_CONFIGURE = "ConfigureWidget";
public static String ACTION_WIDGET_RECEIVER = "ActionReceiverWidget";
@Override
public void onUpdate( Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds )
{
show = getString();
remoteViews = new RemoteViews( context.getPackageName(), R.layout.widget );
remoteViews.setTextViewText( R.id.widget_title, show[0]);
remoteViews.setTextViewText( R.id.widget_textview, show[1]);
Intent configIntent = new Intent(context, SuitAuto.class);
configIntent.setAction(ACTION_WIDGET_CONFIGURE);
Intent active = new Intent(context, WordWidget.class);
active.setAction(ACTION_WIDGET_RECEIVER);
active.putExtra("msg", "Message for Button 1");
PendingIntent actionPendingIntent = PendingIntent.getBroadcast(context, 0, active, 0);
PendingIntent configPendingIntent = PendingIntent.getActivity(context, 0, configIntent, …Run Code Online (Sandbox Code Playgroud) 伙计我有3组用于我的可扩展列表视图,我尝试分别改变每组的颜色,当它们正在扩展并在它们折叠时恢复正常颜色...
我现在面临的问题是,当我点击第一组时,它会改变最后一组的颜色......所以我可以说它们的颜色随机变化而不是相应的组.
这是我使用的简单代码:
listView.setOnGroupClickListener(new OnGroupClickListener()
{
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int position, long id)
{
v.setBackgroundResource(R.drawable.group_bar_press);
Toast.makeText(getBaseContext(), "Group clicked", Toast.LENGTH_LONG).show();
return false;
}
});
Run Code Online (Sandbox Code Playgroud)
好吧,这就是我希望它会被解决:)