当我尝试将ActionbarSherlock添加SearchView到ActionBar时,应用程序会在应显示活动时立即崩溃.作为理由,我在LogCat中找到了以下内容:
10-22 21:22:51.070: W/MenuInflater(21873): Cannot instantiate class: com.actionbarsherlock.widget.SearchView
...
10-22 21:22:51.070: W/MenuInflater(21873): Caused by: java.lang.reflect.InvocationTargetException
10-22 21:22:51.070: W/MenuInflater(21873): at java.lang.reflect.Constructor.constructNative(Native Method)
10-22 21:22:51.070: W/MenuInflater(21873): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
10-22 21:22:51.070: W/MenuInflater(21873): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
10-22 21:22:51.070: W/MenuInflater(21873): ... 32 more
10-22 21:22:51.070: W/MenuInflater(21873): Caused by: android.content.res.Resources$NotFoundException: Resource is not a ColorStateList (color or path): TypedValue{t=0x2/d=0x7f01001f a=-1}
10-22 21:22:51.070: W/MenuInflater(21873): at android.content.res.Resources.loadColorStateList(Resources.java:2035)
10-22 21:22:51.070: W/MenuInflater(21873): at android.content.res.TypedArray.getColorStateList(TypedArray.java:342)
10-22 21:22:51.070: W/MenuInflater(21873): at android.widget.TextView.<init>(TextView.java:768)
10-22 21:22:51.070: W/MenuInflater(21873): at android.widget.TextView.<init>(TextView.java:442)
Run Code Online (Sandbox Code Playgroud)
当我使用常规android.widget.SearchView的android:actionViewClass一切工作正常.我按照Android网站上的 …
我正在尝试在Android中开发Amazon In-app.为此,我从这个网站下载示例代码https://developer.amazon.com/sdk/in-app-purchasing/sample-code/button-clicker.html.本文建议我们必须将文件amazon.sdktester.json放在设备的mnt/sdkcard文件夹中.为此我从这个网站https://developer.amazon.com/sdk/fire/connect-adb.html#InstallApp阅读文章,并做同样的事情.但当我试图在SD卡上推送文件时,eclipse会给我以下错误:
[2012-11-19 13:39:39 - ddms] transfer error: Permission denied
[2012-11-19 13:39:39] Failed to push selection: Permission denied
Run Code Online (Sandbox Code Playgroud)

有没有办法改变Kindle Fire的根文件夹的权限.
我正在为我们的应用程序使用材料组件主题。现在我们想要一个自定义字体,我设法在下面的主题中几乎无处不在地应用它,它使用textAppearance...由材料组件定义的各种属性。
这非常有效,并且该主题也几乎适用于所有地方的 AlertDialogs——消息文本和按钮具有自定义字体,按钮具有正确的强调色等。
无论如何,只有对话框标题保持 Roboto 字体。
<!-- externalized font name for easier change -->
<string name="font_regular" translatable="false" tools:ignore="ReferenceType">@font/atma_regular</string>
<style name="Theme.App" parent="Theme.MaterialComponents.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:textColorPrimary">@color/textColorPrimary</item>
<item name="android:textColorSecondary">@color/textColorSecondary</item>
<item name="textAppearanceHeadline1">@style/TextAppearance.App.Button</item>
<item name="textAppearanceHeadline2">@style/TextAppearance.App.Button</item>
<item name="textAppearanceHeadline3">@style/TextAppearance.App.Button</item>
<item name="textAppearanceHeadline4">@style/TextAppearance.App.Button</item>
<item name="textAppearanceHeadline5">@style/TextAppearance.App.Button</item>
<item name="textAppearanceHeadline6">@style/TextAppearance.App.Button</item>
<item name="textAppearanceSubtitle1">@style/TextAppearance.App.Subtitle1</item>
<item name="textAppearanceSubtitle2">@style/TextAppearance.App.Subtitle2</item>
<item name="textAppearanceBody1">@style/TextAppearance.App.Body1</item>
<item name="textAppearanceBody2">@style/TextAppearance.App.Body2</item>
<item name="textAppearanceButton">@style/TextAppearance.App.Button</item>
<item name="android:textAppearanceLarge">@style/TextAppearance.App.Large</item>
<item name="android:textAppearanceMedium">@style/TextAppearance.App.Medium</item>
<item name="android:textAppearanceSmall">@style/TextAppearance.App.Small</item>
</style>
<style name="TextAppearance.App.Subtitle1" parent="TextAppearance.MaterialComponents.Subtitle1">
<item name="fontFamily">@string/font_regular</item>
<item name="android:fontFamily">@string/font_regular</item>
</style>
...
Run Code Online (Sandbox Code Playgroud)
我试图为警报对话框定义一个额外的主题,如下所示:
<style name="Theme.App" parent="Theme.MaterialComponents.Light.NoActionBar">
...
<item name="alertDialogTheme">@style/Theme.App.AlertDialog</item>
...
</style> …Run Code Online (Sandbox Code Playgroud) android android-alertdialog material-design material-components material-components-android
我有一个应用程序,在屏幕的底部有一个工具栏,其余的充满了自定义视图(请参阅下面的xml).现在,当我将应用程序全屏显示时(我尝试了所有可能性,以编程方式并通过Manifest.xml),当它启动时,整个布局似乎向下移动了大约通知栏的高度.工具栏中的按钮仅在中途可见.有时候,所有这些都会在几秒钟之后或者当我单击工具栏中的按钮时向上移动.

我很确定,这是我的自定义视图的问题,因为如果我用Button等替换它,我就不会得到这个效果.我想它必须与该onMeasure方法有关.我真的不知道如何实现它,我的版本如下所示.自定义视图用于绘制内部,因此基本上它希望尽可能大.
任何帮助将非常感激.我已经搜索了几个小时,但还没有任何线索.
layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<com.example.MyCanvasView
android:id="@+id/canvas"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
/>
<!-- Buttonbar -->
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:orientation="horizontal"
android:background="@android:drawable/bottom_bar"
>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3"
/>
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是我的onMeasure方法:
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int width = MeasureSpec.getSize(widthMeasureSpec);
int height = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(width, height);
}
Run Code Online (Sandbox Code Playgroud) 我有成员类的简单ArrayLists:
ArrayList<Member> mGroupMembers = new ArrayList<>();
ArrayList<Member> mFriends = new ArrayList<>();
Run Code Online (Sandbox Code Playgroud)
会员类:
public class Member {
private String userUID;
private String userName;
public String getUserUID() {
return userUID;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public void setUserUID(String userUID) {
this.userUID = userUID;
}
}
Run Code Online (Sandbox Code Playgroud)
用于朋友的ArrayList包含所有用户朋友.我只想删除好友列表,小组成员如果出现:
mFriends.removeAll(mGroupMembers);
Run Code Online (Sandbox Code Playgroud)
但它没有对mFriends清单做任何事......
查看日志语句,朋友确实出现在mGroupMember列表中.
为什么这不起作用?
我正在使用ListAdapterRecyclerView,在某些情况下,应用程序变得非常慢——它会冻结 10 秒钟,并显示 1000 个项目的列表。
情况是,首先我提交了一个包含 1000 个项目的列表(首先按预期快速提交),然后我再次提交相同的列表,但排序方式不同。
通过调试,我终于发现, ListAdapter 触发了一个notifyItemRangeChanged(0, 999),所以基本上是完整的列表。我在其他地方(这里和这里)读到过,不应该这样做,因为它会使 RecyclerView 变慢——这显然是正确的——但是,我无法影响 ListAdapter 的行为。
有没有人有解决方案?我不想再次删除 ListAdapter,因为对于大多数其他用例,它既快速又方便,可以自动执行各种动画等。
编辑 - 一些代码
代码没有什么花哨的,基本上是这样的:
RecyclerView mListView;
EnryListAdapter mEntryListAdapter; // <-- extends ListAdapter<Entry, VH>
...
mEntryListAdapter = new EntryListAdapter();
mListView.setAdapter(mEntryListAdapter);
mListView.setLayoutManager(new LinearLayoutManager(this));
mListView.setHasFixedSize(true);
((DefaultItemAnimator) mListView.getItemAnimator()).setSupportsChangeAnimations(false);
List<Entry> entryList = getEntryList(); // <-- list with 1000 entries
mEntryListAdapter.submitList(entryList); // <-- first submit is fast
entryList = getDifferentlySortedEntryList(); // <-- list with same entries, sorted differently …Run Code Online (Sandbox Code Playgroud) 有没有办法在不使用AlertDialog方法的情况下在自定义对话框上设置图标?Dialog有标题,但缺少漂亮的分隔符和设置图标的能力,但肯定必须有一种方法来获得两者而不必使用AlertDialog?
嗨,我已经下载了lua提取它并尝试制作它
sg1@kalanamith:~/lua-5.2.1$ make linux test
Run Code Online (Sandbox Code Playgroud)
之后你得到这个错误
ar rcu liblua.a lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o lmathlib.o loslib.o lstrlib.o ltablib.o loadlib.o linit.o
ranlib liblua.a
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX -c -o lua.o lua.c
gcc -o lua lua.o liblua.a -lm -Wl,-E -ldl -lreadline -lncurses
/usr/bin/ld: cannot find -lncurses
collect2: ld returned 1 exit status
make[2]: *** [lua] Error 1
make[2]: Leaving directory …Run Code Online (Sandbox Code Playgroud) 我有以下几行Java代码:
Object[] results = api.getProjects();
for(int i=0; i<results.length; i++){
System.out.println(results[i].toString());
}
Run Code Online (Sandbox Code Playgroud)
这是输出:
TestProject [id=1, name=Test Plan, prefix=MA, notes=, enableRequirements=true, enableTestPriority=true, enableAutomation=true, enableInventory=true, isActive=true, isPublic=true]
Run Code Online (Sandbox Code Playgroud)
我担心的是我如何只得到想要的元素?(即:"name"和"id")
当我运行应用程序并单击工具栏图标时,我得到错误为"没有抽屉视图找到重力LEFT"
这是我的xml文件
main.xml中
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<android.support.v7.widget.Toolbar
android:id="@+id/my_awesome_toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize" />
<android.support.v7.widget.RecyclerView
android:id="@+id/book_list_rv_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="vertical" />
<ListView
android:id="@+id/ListView1"
android:layout_width="241dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#333"
android:choiceMode="singleChoice"
android:divider="#666"
android:dividerHeight="1dp"
android:paddingLeft="15sp"
android:paddingRight="15sp" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
这个id是活动java文件活动文件的代码片段
Toolbar mToolbar = (Toolbar) findViewById(R.id.my_awesome_toolbar);
mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
// drawer
setSupportActionBar(mToolbar);
mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
mToolbar, R.string.app_name, R.string.app_name);
mDrawerLayout.setDrawerListener(mDrawerToggle);
Run Code Online (Sandbox Code Playgroud) 我不确定哪种方式更好的设计表格.
有没有推荐的解决方案,还是我应该坚持自己喜欢的解决方案?
由于基于此定义的极大查找表,我遇到了这个编译器错误:
//92 X 182 array
private static final double[][] lookUpTable = new double[][]
{
{ numbers....}
};
Run Code Online (Sandbox Code Playgroud)
据我所知,将其分解是一种解决方案,但要准确地分割这个阵列是非常困难的.我也相信我可以把它移到一个文件,但我不知道我是否可以用一种方式来帮助我格式化,而且我不想每秒都读取文件.还有其他建议可以帮助我解决这个问题吗?
android ×9
java ×3
amazon ×1
arraylist ×1
arrays ×1
dialog ×1
forms ×1
icons ×1
in-app ×1
kindle-fire ×1
listadapter ×1
lua ×1
material-components-android ×1
parsing ×1
ubuntu-12.04 ×1
usability ×1