小编Das*_*all的帖子

通过动画将视图的可见性设置为可见的可见性

我有一个invisible默认的视图(只是第一次).

现在我需要的可视性切换到VISIBLE与此animation:

if (myView.getVisibility() == View.INVISIBLE) {
    myView.setVisibility(View.VISIBLE);
    myView.animate().translationY(0);
 }
Run Code Online (Sandbox Code Playgroud)

(就像SnackBar默认动画一样)

但这不起作用.它将使用默认动画变为可见

有什么简单的方法可以达到这个目的吗?

注意

我想要解雇我的观点,就像这样:

myView.animate().translationY(myView.getHeight());
Run Code Online (Sandbox Code Playgroud)

animation android visibility android-animation

17
推荐指数
4
解决办法
3万
查看次数

在listview中获取imageview位置

我有一个List视图,我通过mysql数据库填充行.

这是我所做的一切:

在此输入图像描述

您看到的这些名称来自我的数据库,而PLAY ImageView来自我的布局列表,显示在每一行中(当我向我的数据库中添加一行时).

现在我的问题是当我将点击监听器设置为该播放按钮时(目的是将其切换为暂停ImageView等).它还会从另一行更改另一个播放按钮,但不是全部.因此,我认为我没有得到这个职位,对吗?请帮帮我吧!

这是我的片段:

public class XXXUpdatesFragment extends Fragment implements AsyncResponse
,AdapterView.OnItemClickListener{

    View view ;
    private ArrayList<Product> productList;
    private ListView lvProduct;
    private FunDapter<Product> adapter;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.xxx_updates_layout, container, false);
        ImageLoader.getInstance().init(UILConfig.config(getActivity()));

        lvProduct = (ListView)view.findViewById(R.id.lvProduct);

        PostResponseAsyncTask taskRead = new PostResponseAsyncTask(getActivity(), this);

        taskRead.execute("http://symphonyrecords.6te.net/product.php");

        return view;

    } //onCreate


    @Override
    public void  processFinish(String s) {
        productList = new JsonConverter<Product>().toArrayList(s, Product.class);

        BindDictionary<Product> dict = new BindDictionary<Product>();
        dict.addStringField(R.id.tvName, new …
Run Code Online (Sandbox Code Playgroud)

android listview adapter android-arrayadapter android-adapter

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

单击 android 通知后退出应用程序

我已经实现了一种方法,当我的应用程序在后台运行时,通知将显示在通知栏上。现在我想在单击该通知时关闭应用程序:

Intent intent = new Intent(this, Main.class);
PendingIntent pIntent = PendingIntent.getActivity(this, 
                            (int) System.currentTimeMillis(), intent, 0);
if (Build.VERSION.SDK_INT < 16) {
    Notification n  = new Notification.Builder(this)
            .setContentTitle("Flashlight")
            .setContentText("turn off")
            .setSmallIcon(R.mipmap.light_on)
            .setContentIntent(pIntent)
            .setAutoCancel(true).getNotification();
    NotificationManager notificationManager =
            (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    notificationManager.notify(0, n);
} else {
    Notification n  = new Notification.Builder(this)
            .setContentTitle("Flashlight")
            .setContentText("turn off")
            .setSmallIcon(R.mipmap.light_on)
            .setContentIntent(pIntent)
            .setAutoCancel(true).build();
    NotificationManager notificationManager =
            (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
    notificationManager.notify(0, n);
}
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点 !?

android android-notifications

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