我已經下載android process button lib並將其導入到我的eclipse中。 :如何使用android進程按鈕庫
Android的過程按鈕lib目錄下:
我創建一個Android項目,然後我加入這個lib放到我的項目:
現在,我想使用這個庫但我得到這個錯誤:
Progres sGenerator不能被解析爲一個類型
我使用日食。
我已經下載android process button lib並將其導入到我的eclipse中。 :如何使用android進程按鈕庫
Android的過程按鈕lib目錄下:
我創建一個Android項目,然後我加入這個lib放到我的項目:
現在,我想使用這個庫但我得到這個錯誤:
Progres sGenerator不能被解析爲一個類型
我使用日食。
@NIPHIN答案是正確的。正如你可以注意到庫正在使用gradle文件夾結構。
這裏有2種選擇:
com.dd...
文件夾src文件夾。res
和類複製到新建的文件夾。查看項目結構,在eclipse中重新組織文件夾「java」以反映文件夾結構爲相同文件夾「src」。 Eclipse和Studio IDE具有不同的文件夾結構。
現在,我該怎麼辦? – 2014-08-28 07:57:10
按照Dmytro Danylyk的說法重新整理文件夾結構。 – NIPHIN 2014-08-28 08:30:59
我不知道你是如何整合它,但例子清楚地說明進口
import com.dd.processbutton.iml.ActionProcessButton;
import com.dd.processbutton.iml.GenerateProcessButton;
import com.dd.processbutton.iml.SubmitProcessButton;
儘管該項目已作爲一個依賴庫,你還需要有這些import語句。可能是日食有麻煩自動添加這些導入? Jut手動添加它們。如果你的文件夾結構和導入是正確的,它應該工作。
線程有點老,但也許我可以幫你。
I'll您展示與ActionProcessButton
首先在佈局的一個例子,u需要特定的按鈕。例如:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<com.dd.processbutton.iml.ActionProcessButton
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_marginBottom="16dp"
android:textColor="@android:color/white"
android:textSize="18sp"
android:text="@string/login"
android:id="@+id/loginButton"
android:textAllCaps="true"
custom:pb_colorComplete="@color/green_complete"
custom:pb_colorNormal="@color/blue_normal"
custom:pb_colorPressed="@color/blue_pressed"
custom:pb_colorProgress="@color/purple_progress"
custom:pb_textComplete="@string/login_successfull"
custom:pb_textProgress="@string/login_auth" />
</RelativeLayout>
您activiy /片段/不管裏面:
public class LoginFragment extends Fragment {
private ActionProcessButton loginButton;
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.login_fragment, container, false);
loginButton = (ActionProcessButton) view.findViewById(R.id.loginButton);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loginButton.setProgress(50); // starts the Animation and sets the text defined in your .xml file for Progress
loginDone();
}
});
}
private void loginDone(){
//...
// do something time-consuming
loginButton.setProgress(100); // tolds the button, that your operation is done.
}
// ...
}
當然,你也可以動態更新的進展狀態,但我知道,對於setProgress的臨界值是-1(登錄失敗),0,50和100.
嘗試清理並構建您的項目 – NIPHIN 2014-08-28 06:53:29
我之前測試過。沒有改變。 – 2014-08-28 06:58:52