小编Mok*_*pps的帖子

Android:我的应用程序小部件与ListView没有通过按钮或更新期更新

我正在使用小部件来显示RSS提要.显示了Feed但我无法通过单击按钮进行更新.在窗口小部件配置xml中设置的更新周期后,列表也不会更新.

你能帮我么?

WidgetProvider

public class WidgetProvider extends AppWidgetProvider {

    //Tag for Logging
    private static final String TAG = "Widget";

    // String to be sent on Broadcast as soon as Data is Fetched
    // should be included on WidgetProvider manifest intent action
    // to be recognized by this WidgetProvider to receive broadcast
    public static final String DATA_FETCHED = "mypackage.DATA_FETCHED";
    public static final String EXTRA_LIST_VIEW_ROW_NUMBER = "mypackage.EXTRA_LIST_VIEW_ROW_NUMBER";
    public static final String WIDGET_BUTTON = "mypackage.WIDGET_BUTTON";

    /*
     * this method is called every 30 …
Run Code Online (Sandbox Code Playgroud)

android refresh android-widget android-listview

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

Android:ShowCase View只显示一次并重复动画

我在我的片段中使用ShowCase View库.我展示了一个手势动画,应该重复,直到用户按下OK按钮.但只显示一次.

每次创建片段时都会显示展示,而不仅仅是一次.

我的代码看起来像这样:

public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        //get display size for slide over screen
        Display display = getActivity().getWindowManager().getDefaultDisplay();
        Point p = new Point();
        display.getSize(p);

        if(!is_tablet()){
            // ShowView Tutorial if on smartphone
            ViewTarget target = new ViewTarget(getView());
            ShowcaseView.ConfigOptions co = new ShowcaseView.ConfigOptions();
            //can only dismiss by button click
            co.hideOnClickOutside = false;
            //show only once
            co.shotType = ShowcaseView.TYPE_ONE_SHOT;
            sv = ShowcaseView.insertShowcaseView(target, getActivity(),
                    R.string.showcase_detail_title, R.string.showcase_detail_message,co);
            // remove circle
            sv.setShowcaseIndicatorScale(0);
            // set black background
            sv.setBackgroundColor(getResources().getColor(R.color.black));
            // make background a …
Run Code Online (Sandbox Code Playgroud)

android android-animation android-fragments showcaseview

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

未显示CardView中View的Android高程

我在CardView中有一个RelativeLayout,我想在Android Lollipop中提升但是没有显示高程(阴影没有显示):

在此输入图像描述

我的布局文件:

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:android.support.v7.cardview="http://schemas.android.com/apk/res-auto"
    style="@style/CardViewStyle"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:elevation="5dp"
    android:orientation="horizontal"
    android.support.v7.cardview:cardElevation="5dp">

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/list_selector"
    android:paddingBottom="5dp">

    <ImageView
        android:id="@+id/article_thumb"
        android:layout_width="match_parent"
        android:layout_height="150dp"
        android:layout_alignParentTop="true"
        android:contentDescription="@string/app_name"
        android:scaleType="centerCrop" />

    <TextView
        android:id="@+id/article_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/article_thumb"
        android:layout_marginEnd="10dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginStart="10dp"
        android:ellipsize="middle"
        android:linksClickable="false"
        android:longClickable="false"
        android:text="@string/title"
        android:textAppearance="@style/TextAppearance.AppCompat.Title"
        android:textColor="@color/black" />

    <TextView
        android:id="@+id/article_date"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/article_title"
        android:layout_alignStart="@+id/article_title"
        android:layout_below="@+id/article_title"
        android:layout_marginTop="10dp"
        android:text="@string/date"
        android:textAppearance="@style/TextAppearance.AppCompat.Light.Widget.PopupMenu.Small"
        android:textColor="@color/gray" />

    <RelativeLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignEnd="@+id/article_title"
        android:layout_alignRight="@+id/article_title"
        android:layout_below="@+id/article_title"
        android:layout_marginTop="10dp"
        android:elevation="30dp"
        android:translationZ="30dp">

        <ImageView
            android:id="@+id/redbubble"
            android:layout_width="25dp"
            android:layout_height="25dp"
            android:layout_gravity="center"
            android:contentDescription="@string/app_name"
            android:scaleType="centerCrop"
            android:src="@drawable/redbubble" />

        <TextView
            android:id="@+id/article_comment_bubble"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentTop="true" …
Run Code Online (Sandbox Code Playgroud)

android material-design android-cardview android-5.0-lollipop android-elevation

3
推荐指数
2
解决办法
1万
查看次数

ListView具有不同的布局和两个不同的对象

我想为奇数行和偶数行填充具有不同布局的ListView.它应该如下所示:

在此输入图像描述

我使用两个对象"OddListItem"和"EvenListItem"来存储/访问数据.我不知道如何将两个对象传递给我的自定义listview适配器并获得正确的视图.

我的对象类:

public class OddListItem {

    private String time_start;
    private String time_end;
    private String location;

    public OddListItem(String time_start, String time_end, String location) {
        super();
        this.time_start = time_start;
        this.time_end = time_end;
        this.location = location;
    }

    // getters and setters
    void setTimeStart(String time_start) {
        this.time_start = time_start;
    }

    void setTimeEnd(String time_end) {
        this.time_end = time_end;
    }

    void setLocation(String location) {
        this.location = location;
    }

    public String getTimeStart() {
        return time_start;
    }

    public String getTimeEnd() {
        return time_end;
    }

    public String getLocation() …
Run Code Online (Sandbox Code Playgroud)

android listview android-listview android-adapter baseadapter

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