因为差不多2个月我正在寻找以下问题的解决方案.我在我的应用程序中实现了一个库,其中还包括IInAppBillingService.aidl文件和Google的In App Billing Library的其他部分.当我试图编译我的应用程序的发布版本时,它只会抛出以下错误:
Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'.
Run Code Online (Sandbox Code Playgroud)
com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com/android/vending/billing/IInAppBillingService $ Stub $ Proxy.class
目前我只是使用这个库进行应用程序购买,而不是直接将它放在我的应用程序中.这在大多数情况下工作正常,但真正让我紧张的是我无法改变IabHelper.class中的任何内容.由于我们都不认为Google In App Billing解决方案有时会出错,所以我想编辑IabHelper.class.所以现在2"IInAppBillingService.aidl"文件的问题显然已经回来了.我已经尝试用fowlling代码排除这部分库:
compile ('com.adobe.creativesdk:image:4.4.8') {
exclude module: 'com.android.vending.billing'
}
Run Code Online (Sandbox Code Playgroud)
它不起作用..... :(我能做什么?你还有其他解决办法吗?我讨厌浪费在所有图书馆问题上的时间.....
非常感谢!!
android gradle in-app-billing build.gradle android-gradle-plugin
我正在尝试使用Clans/FloatingActionButton创建浮动操作菜单,但我在布局文件中收到命名空间“fab”未绑定错误。我已经包含了的依赖,compile 'com.github.clans:fab:1.6.4'所以我不知道出了什么问题。
这是我的布局文件。
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.kabricks.betterapp.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
<com.github.clans.fab.FloatingActionButton
android:id="@+id/material_design_android_floating_action_menu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="11dp"
android:layout_marginLeft="11dp"
android:layout_marginRight="11dp"
app:menu_animationDelayPerItem="55"
app:menu_backgroundColor="@android:color/transparent"
fab:menu_buttonSpacing="0dp"
fab:menu_colorNormal="#da3c2f"
fab:menu_colorPressed="#dc4b3f"
fab:menu_colorRipple="#99d4d4d4"
fab:menu_fab_label="Floating Action Menu"
fab:menu_fab_size="normal"
fab:menu_icon="@drawable/fab_add"
fab:menu_labels_colorNormal="#333"
fab:menu_labels_colorPressed="#444"
fab:menu_labels_colorRipple="#66efecec"
fab:menu_labels_cornerRadius="3dp"
fab:menu_labels_ellipsize="none"
fab:menu_labels_hideAnimation="@anim/fab_slide_out_to_right"
fab:menu_labels_margin="0dp"
fab:menu_labels_maxLines="-1"
fab:menu_labels_padding="8dp"
fab:menu_labels_position="left"
fab:menu_labels_showAnimation="@anim/fab_slide_in_from_right"
fab:menu_labels_showShadow="true"
fab:menu_labels_singleLine="false"
fab:menu_labels_textColor="#f2f1f1"
fab:menu_labels_textSize="15sp"
fab:menu_openDirection="up"
fab:menu_shadowColor="#66aff198"
fab:menu_shadowRadius="4dp"
fab:menu_shadowXOffset="1dp"
fab:menu_shadowYOffset="4dp"
fab:menu_showShadow="true">
<com.github.clans.fab.FloatingActionButton
android:id="@+id/material_design_floating_action_menu_item1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_action_send"
fab:fab_label="Menu …Run Code Online (Sandbox Code Playgroud) 这就是我要实现的
我尝试过的是,在单击每个项目时将布局动态添加到recycleView。但是我认为这不是一种有效的方法。
请注意,这是一个类似于结构的目录,其中每个文件夹可以具有子文件夹,每个子文件夹可以具有子文件夹,依此类推。
请提出其他选择。
java android android-layout android-view android-recyclerview
我有两个如下所示的布局文件。
如果列表中存在数据,则显示此布局。
当列表为空时,我将显示此布局。
现在,我想在运行时更改布局。当用户从列表中删除最后一个项目时,我想将布局更改为第二个图像中显示的“空购物车布局”。
在getItemCount()RecyclerView适配器的方法中,如果列表为空或null,则返回count,1否则返回list.size()
这是我的适配器代码。
public class CheckOutAdapter extends RecyclerView.Adapter<CheckOutAdapter.ViewHolder> {
public ArrayList<Design> designList;
private Context context;
private LayoutInflater layoutInflater;
public CheckOutAdapter(Context context, ArrayList<Design> designList) {
this.designList = designList;
this.context = context;
this.layoutInflater = LayoutInflater.from(context);
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if(designList.isEmpty() || designList == null || designList.size() == 0) {
View view = layoutInflater.inflate(R.layout.empty_cart, parent, false);
return new ViewHolder(view);
} else {
View view = layoutInflater.inflate(R.layout.checkout_single_design, parent, false);
return new …Run Code Online (Sandbox Code Playgroud) java android android-layout recycler-adapter android-recyclerview
有没有办法让文本显示在Android工作室的预览窗格中,而不是在手机上运行时显示在实际的应用程序中?
我目前使用该android:hint属性,这对于查看需要多少空间TextView或文本大小非常有用.
但问题是,如果没有分配文本TextView,则提示会显示在应用程序中.
有没有办法让文本只在android studio中显示,而不是在运行时?
我正在尝试访问我的应用程序中EditText的SearchView (v7)字段,但我总是以空指针异常告终。到目前为止,我已经尝试了解决方案,并试图通过访问EditView中android:id/search_plate,R.id.search_plate,R.id.search_src_text和android:id/search_src_text,但一切都是徒劳。
代码:
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.frag_menu_items, menu);
MenuItem menuItem = menu.findItem(R.id.action_search);
searchView = (SearchView) MenuItemCompat.getActionView(menuItem);
searchPlateId = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null);
searchPlate = (EditText) searchView.findViewById(searchPlateId);
searchPlate.setImeOptions(EditorInfo.IME_ACTION_SEARCH);
searchPlate.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int actionId, KeyEvent keyEvent) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
ToastClass.getInstance().showCustomMsg(getActivity(),searchPlate.getText().toString());
}
return false;
}
});
//searchView.setOnQueryTextListener(this);
MenuItemCompat.setOnActionExpandListener(menuItem, new MenuItemCompat.OnActionExpandListener() {
@Override
public boolean onMenuItemActionCollapse(MenuItem item) {
// Do …Run Code Online (Sandbox Code Playgroud) 我有一个Snackbar,应该显示,以防万一在向服务器请求数据后找不到任何度假村.每次Snackbar需要显示时我都会遇到以下异常:
java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: android.view.InflateException: Binary XML file line #41: Binary XML file line #41: Error inflating class <unknown>
at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
at android.support.design.widget.Snackbar.make(Snackbar.java:143)
at com.tripoffbeat.Result$LoadAllResorts.doInBackground(Result.java:565)
at com.tripoffbeat.Result$LoadAllResorts.doInBackground(Result.java:432)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: android.view.InflateException: Binary XML file line #41: Error inflating class <unknown>
at …Run Code Online (Sandbox Code Playgroud) 什么事件表示a的抽签View完成?
我了解ViewTreeObserver听众,但我找不到“最终”听众,这表明工作已完成。
android textview android-layout android-view android-viewtreeobserver
我正在尝试创建一个覆盖窗口,但是当我尝试将视图添加到 WindowManager 时,它给了我一个异常。我添加了“SYSTEM_ALERT_WINDOW”权限,并在应用信息中启用了“绘制其他应用”。我从服务的 onCreate 函数中调用它。
代码:
WindowManager manager = (WindowManager)getSystemService(WINDOW_SERVICE);
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
RelativeLayout overlay = (RelativeLayout) inflater.inflate(R.layout.button_main, null);
final WindowManager.LayoutParams params =
new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_APPLICATION_PANEL,
0,
PixelFormat.TRANSLUCENT);
params.gravity = Gravity.TOP | Gravity.START;
params.x = 0;
params.y = 0;
manager.addView(overlay, params);
Run Code Online (Sandbox Code Playgroud)
异常堆栈跟踪:
Caused by: android.view.WindowManager$BadTokenException: Unable to add window -- token null is not valid; is your activity running?
at android.view.ViewRootImpl.setView(ViewRootImpl.java:764
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:356)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:92)
Run Code Online (Sandbox Code Playgroud)
无论我为 …
android android-service android-layout android-view android-windowmanager
我试图从共享元素返回转换中排除一个视图组,比如说回收器视图。但问题是我不希望回收器视图的所有子级都排除在外,我希望特定的回收器视图子级包含转换。
Slide transition = new Slide(Gravity.END);
transition.excludeTarget(recyclerView, true);
transition.addTarget(ImageView.class);
setExitTransition(transition);
setReturnTransition(transition);
Run Code Online (Sandbox Code Playgroud)
我不明白为什么上面的代码不起作用。如果您有任何想法或任何方法来实现这一目标,请告诉我?
animation android android-animation android-transitions shared-element-transition
android ×10
android-view ×5
java ×4
xml ×3
textview ×2
animation ×1
build.gradle ×1
gradle ×1
searchview ×1