小编Cod*_*joy的帖子

在没有它的情况下调用android对话框淡化背景

我有这个很好的对话框视图我将UserInputDialog类设置为:

    <LinearLayout android:id="@+id/LinearLayout01" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android">

        <TextView
        android:id="@+id/nameMessage"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="What is your name Captain?"
        >
        </TextView>
        <EditText
        android:id="@+id/nameEditText"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textSize="18sp"
        >
        </EditText>
    <LinearLayout android:id="@+id/LinearLayout02" android:layout_width="fill_parent" android:layout_height="wrap_content" 
        android:layout_gravity="center_horizontal">
    <Button
        android:id="@+id/okButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="OK">
        </Button>
        <Button android:id="@+id/cancelButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Cancel">
        </Button>               
    </LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我想让我的对话框出现,但背景不会淡出.这可能吗?导致调用此对话框的视图具有neato背景我希望将其显示为对话框的背景.

我在网上发现了这个:

<style name="doNotDim" parent="@android:style/Theme.Dialog">
    <item name="android:backgroundDimAmount">0</item>
</style >
Run Code Online (Sandbox Code Playgroud)

但不知道如何将其应用于我的对话框?我有一个叫做的课public class UserInputDialog extends Dialog implements OnClickListener.它将其内容视图设置为上述布局.

我想我正在这样做,只是不知道如何添加这种风格,所以我不能淡化背景.

次要问题:您是否可以通过使用主题在对话框中获得新的外观(通过显示带有文字的图像或图标)?

android dialog views

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

each_with_index_do从1开始索引

我在rails应用程序中的视图上使用ruby迭代器,如下所示:

<% (1..@document.data.length).each_with_index do |element, index| %>
  ...
<% end %>
Run Code Online (Sandbox Code Playgroud)

我认为增加了1 ..而不只是说: @document.data

会得到上面的索引从1开始的技巧.但是,唉,上面的代码索引仍然是0到data.length(-1有效).所以我做错了什么,我需要索引等于1-data.length ...没有线索如何设置迭代器来做到这一点.

ruby iterator ruby-on-rails-3

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

ORMLite和图像在Android上保存为BLOB

所以我最近在我正在编写的Android平板电脑应用程序中将我的数据库内容转换为ORMLite.到目前为止一切都很好,大多数事情被重构/重新编码.虽然我对最初作为BLOB存储在数据库中的内容有疑问.在我的原始数据模型中,它看起来像这样:

byte[] imageBytes;
Run Code Online (Sandbox Code Playgroud)

但我不认为我可以在ORMLite中使用它,最好我可以告诉它必须是一个字符串,所以现在我有:

@DatabaseField
String picture;
Run Code Online (Sandbox Code Playgroud)

但现在,我很困惑如何读取和写入这些数据位作为字节等...我使用这样的代码来传输数据到数据库和从数据库传输数据:

...
//Set the clients image to what was captured...
Bitmap resized2= android.graphics.Bitmap.createScaledBitmap(thumbnail, thumbnail.getWidth()/2, thumbnail.getHeight()/2, true);
ByteArrayOutputStream baos = new ByteArrayOutputStream();  
resized2.compress(Bitmap.CompressFormat.PNG, 100, baos); //bm is the bitmap object   
byte[] b = baos.toByteArray();  

mClient.setImageBytes(b);
myImage.setImageBitmap(resized2);
//do save to the database of the image to the blob whose column is picture
ContentValues initialValues = new ContentValues();
initialValues.put("picture", mClient.getImageBytes());
String [] strArray = {""+sid};
long n = dbAdapter.updateRecordsInDB("clients", initialValues, "_id=?", strArray);      
Run Code Online (Sandbox Code Playgroud)

那么现在我是如何保存图像的,如果ORMLite中没有BLOBS并且我必须使用字符串,我不知道如何做到这一点?

为了完整性,我将如何显示图像:

if(mClient.getImageBytes().length <= …
Run Code Online (Sandbox Code Playgroud)

database android ormlite

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

尝试修复机器人"不明智或错误地使用核心课程"变坏了

在尝试通过我在网络上看到的自己解决这个问题后,我仍然无法弄清楚这意味着什么:

[2013-08-15 23:58:27 - StudioTab] Dx 
trouble processing "javax/xml/namespace/QName.class":

Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.

This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.

However, you might actually be trying to define a class …
Run Code Online (Sandbox Code Playgroud)

java android android-emulator

11
推荐指数
2
解决办法
8635
查看次数

如果禁用了rails中的text_field_tag表单助手,它是否不提交?

我的表单中有一个text_field_tag,我真的希望它只是用于显示(我的所​​有jquery更新此文本字段),使用日期选择器.虽然我不希望用户在这里输入,所以我说:disabled => true并确定它被禁用,值在这里改变但是在我的ajax远程调用中他们不保存,只有当text_field_tag被启用时才会保存.这有什么工作吗?

jquery form-helpers ruby-on-rails-3.2

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

错误:ArrayAdapter要求资源ID为TextView

这是什么意思?我一直在与之斗争ListView,我使用过ArrayAdapter.我写了这个很好的对话框片段,我已经调用了一个updateUI列表器,因为我想要更新这个ListView我在我的片段DialogFragment中起初ArrayAdapter是一个复杂类型的我创建的:

ArrayAdapter<Location> theLocations;
...
//in oncreateview
theLocations = new ArrayAdapter<Location>(mContext, R.layout.location_row, locations);
//here locations is an ArrayList<Location>
Run Code Online (Sandbox Code Playgroud)

然后我有:

public void onUIUpdate(Location l) { //called from dialog fragment      
 locations.add(l);                  
 theLocations.notifyDataSetChanged();       
}
Run Code Online (Sandbox Code Playgroud)

然后,这给出了上述错误,所以我切换它只使用一个

String[] locationNames = new String[sizeofLocations];
theLocations=new ArrayAdapter<String>(mContext, R.layout.location_Row, locationNames );

public void onUIUpdate(Location l) {        
    locations.add(l);                   
            locationNames = new String[locations.size()];
            for(locations.size() etc...) { 
               locationNames [i] = new String(locations.get(i).getName());
            }
    theLocations.notifyDataSetChanged();        
}
Run Code Online (Sandbox Code Playgroud)

这在我的更新方法中没有错误(更新了ui)但它没有更新任何东西.所以我迷失了如何更新这个ArrayAdapter,我认为notifyChange应该这样做,但它要么什么都不做,要么抛出上面的错误.

我的程序中的其他地方的SimpleCursorAdapters没有问题(只要我的游标保持打开状态,我就会对它们进行重新查询).

我对错误的看法有何见解?

根据要求,这里是R.layout.location_row的布局

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout …
Run Code Online (Sandbox Code Playgroud)

android android-arrayadapter android-listview

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

使用Canvas.DrawBitmap在Android中进行Sprite旋转.我很接近,我做错了什么?

我有这个精灵旋转算法(它的命名很差,只是用于测试).它是如此接近,用它绘制的精灵旋转.每一帧我都可以加上+5度,看到我漂亮的小精灵旋转.问题是,画布上绘制的其他东西现在都在闪烁.如果我不进行旋转,则常规绘制的精灵效果很好.我想我很接近,但我不知道我错过了什么.下面是我的两个"Draw_Sprite"方法,一个只是将先前资源加载的位图绘制到传入的画布.另一个,做一些旋转最好我知道如何旋转精灵这么多x度...然后绘制它.如果我有一个很好的游戏循环来绘制几个对象,一种类型是旋转的类型.然后非旋转的精灵闪烁,但旋转的精灵永远不会闪烁.

    /*************************************************
 * rotated sprite, ignore the whatever, its for ease of use and testing to have this argument list
 * @param c canvas to draw on.
 * @param whatever ignore 
 * @param rot degrees to rotate
 * @return
 */
public int Draw_Sprite(Canvas c, int whatever, int rot) {   
    //rotating sprite
    Rect src = new Rect(0, 0, width, height);
    Rect dst = new Rect(x, y, x + width, y + height);
    Matrix orig = c.getMatrix();        
    mMatrix = orig;
    orig.setTranslate(0, 0); …
Run Code Online (Sandbox Code Playgroud)

android rotation sprite

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

Spark/Neo4j抛出错误:RuntimeException:java.util.Collections $ UnmodifiableRandomAccessList不是字符串模式的有效外部类型

确切的查询:

call spatial.bbox('geom', {lat:37.5,lon:43.4}, {lat:37.6,lon:43.5}) yield node return node.altitude as altitude, node.detect_type as detect_type, node.gtype as gtype, node.toDateFormatLong as toDateFormatLong, node.change_area as change_area, node.latitude as latitude, node.longitude as longitude, node.fromDateFormatLong as fromDateFormatLong, node.iids as iids, node.detect_strength as detect_strength, node.fromDate as fromDate, node.bbox as bbox ORDER BY node.toDateFormatLong DESC
Run Code Online (Sandbox Code Playgroud)

示例数据集:

????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?"altitude"?"detect_type"?"gtype"?"toDateFormatLong"?"change_area"?"latitude"?"longitude"?"fromDateFormatLong"?"iids"                                                               ?"detect_strength"?"fromDate"?"bbox"                                       ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?-1        ?"Arrival"    ?1      ?20161104          ?16981        ?37.5608649?43.4297988 ?20161023            ?"23OCT16S1A89377_09_IW1_09_pp_1231_04NOV16S1A90776_09_123_31_TT_QQQQ”?7.2              ?"23OCT16" ?[43.4297988,37.5608649,43.4297988,37.5608649]?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
?-1        ?"Arrival"    ?1      ?20161104          ?3123         ?37.56749  ?43.4807208 ?20161023            ?"23OCT16S1A89377_09_IW1_09_pp_1231_04NOV16S1A90776_09_124_32_TT_QQQQ"?7.5              ?"23OCT16" ?[43.4807208,37.56749,43.4807208,37.56749]    ?
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Run Code Online (Sandbox Code Playgroud)

我打电话给你

try …
Run Code Online (Sandbox Code Playgroud)

scala geospatial neo4j neo4j-spatial apache-spark

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

使用neo4j连接器的火花,neo4j超时?

编辑:我已经尝试了几件事来使这个工作完成,似乎没有任何工作:

更新了neo4j-community.vmoptions:

-server
-Xms4096m
-Xmx4096m
-XX:NewSize=1024m
Run Code Online (Sandbox Code Playgroud)

还更新了我的mac以处理更多线程.

C02RH2U9G8WM:~ meuser$ ulimit -u
709
C02RH2U9G8WM:~ meuser$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 256
pipe size            (512 bytes, -p) 1
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 709
virtual memory          (kbytes, -v) unlimited
Run Code Online (Sandbox Code Playgroud)

最后进行了测试,以确保它不是导致问题的有限硬盘空间.一切似乎都结束了,在执行过程中我会在另一个窗口检查我的线程使用情况....

jstack -l 'pid' | …
Run Code Online (Sandbox Code Playgroud)

scala neo4j apache-spark

6
推荐指数
0
解决办法
160
查看次数

片段和framelayout的布局由另一个片段和framelayout替换

编辑:

所以在下面的评论之后,我重新审视并意识到是什么让我失望.

想象一下,我的客户列表和客户详细活动可以通过以下方式启动

public class ClientsMainActivity extends FragmentActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //StudioTabOpenHelper db;
        setContentView(R.layout.main_client_activity);
    }
}
Run Code Online (Sandbox Code Playgroud)

所以这很好用,启动我的main_client_Activity(在下面的布局中定义,当我点击主屏幕上的按钮时我调用此活动):

Intent intent = new Intent(getActivity(), ClientsMainActivity.class);
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

问题很简单,ClientsMainActivity不会调用OnCreateView或任何东西,只需将布局设置为定义我的Fragment和我的ListFragment的布局.这很好,因为我不想把任何东西传递给ClientsMainActivity,但如果我有一个假设的活动,如:

SessionMainsActivity当他们点击客户端的会话编辑时调用,然后我不会以SessionsMainActivity相同的方式调用(启动只设置为alayout的活动),我希望布局设置为定义我的片段如何分割.但是我也希望将数据传递给它,然后传递给后续的片段(比如他们点击哪个会话进行编辑/混音).

所以我想知道上述是否有意义,我确信这是一个简单的事情,我无法将我的大脑包裹起来.我没有问题FragmentActivitie从其他片段调用s,它们占用了整个屏幕,但它的工作原理.所以我想最大的问题就是ClientsMainActivity我在网上找到的一些例子,用于制作食谱,向您展示如何在屏幕上制作多个片段.让我完成所有FragmentActivity工作的是将内容视图设置为执行所有工作的布局,这就是为什么我无法弄清楚如何编写它以执行相同的操作但让我将值传递给布局定义的片段等...

结束编辑

所以我在这里使用这个漂亮的小教程:

http://developer.android.com/guide/topics/fundamentals/fragments.html

它让我走了很长的路,并利用他们所说的主要活动和fragment_layout.xml,我在左边有一个很好的客户列表(这是一个列表碎片)和右边的细节片段.

然后,我添加了在客户端上编辑会话信息的功能(或编辑客户端详细信息),这两者都是全屏片段.这很有效.

现在我决定我的会话编辑ui最好将服务再次分成两个窗格.

这不像我想的那样工作,就像我说我在onCreate中有一个main_Activity这样做:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_client_activity);
}
Run Code Online (Sandbox Code Playgroud)

main_client_activity.xml正在两个布局定义,但在一个风景片是在这里:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="horizontal"
   android:layout_width="match_parent"
   android:layout_height="match_parent">

   <fragment class="com.viciousbytes.studiotab.subactivities.ClientListView"
        android:id="@+id/client_list" android:layout_weight="1"
        android:layout_width="0px" android:layout_height="match_parent" />

   <FrameLayout android:id="@+id/client_details" …
Run Code Online (Sandbox Code Playgroud)

android android-fragments

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