小编cla*_*n33的帖子

相当于数组的push()或pop()?

我试图添加,删除和引用我在我的主java文件中创建的数组中的项目,但我无法找出正确的语法.在actionscript中,他们有push()和pop()来添加和删除数组中的项目,在android中是否有相同的东西?

java android

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

找不到处理Intent的Activity

我试图发起一个打开Android市场链接的意图.

android manifest部分看起来像这样:

<activity android:name="com.surreall.sixdice.Start" android:label="Six Dice" android:screenOrientation="portrait" android:configChanges="keyboardHidden|orientation">
    <intent-filter>
                <action android:name="android.intent.action.MAIN" />                               
                <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    <intent-filter>
                <action android:name="android.intent.action.VIEW" />  
                <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)

启动意图如下:

public void onClick(View v) {
        String PublisherID = "pub:surreallgames";
        Uri marketUri = Uri.parse("market://search?q="+PublisherID);
        Intent marketIntent = new Intent(Intent.ACTION_VIEW, marketUri);                    
        startActivity(marketIntent);


                }
Run Code Online (Sandbox Code Playgroud)

logcat输出:

06-17 17:38:47.393: E/AndroidRuntime(476): FATAL EXCEPTION: main
06-17 17:38:47.393: E/AndroidRuntime(476): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=market://search?q=pub:surreallgames }
06-17 17:38:47.393: E/AndroidRuntime(476):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
06-17 17:38:47.393: E/AndroidRuntime(476):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
06-17 …
Run Code Online (Sandbox Code Playgroud)

android android-intent

38
推荐指数
4
解决办法
6万
查看次数

如何在android中的图像按钮上保持宽高比?

我有5个方形的ImageButtons,我想在屏幕的底部并排排列.我有每一组(不同的id):

        <ImageButton
         android:id="@+id/box1" 
         android:layout_width="fill_parent"
         android:layout_height="wrap_content" 
         android:layout_gravity="center"
         android:adjustViewBounds="true"
         android:scaleType="fitXY"
         android:layout_weight="1"
         android:layout_margin="1dp"
         /> 
Run Code Online (Sandbox Code Playgroud)

我在主java中分配了这样的背景:

    int[] imageIds = new int[] {R.id.box1,R.id.box2,R.id.box3,R.id.box4,R.id.box5};
    for(int i = 0; i<5; i++){
        imageButtons[i] = (ImageButton) findViewById(imageIds[i]);
        imageButtons[i].setBackgroundResource(R.drawable.blank);
    }
Run Code Online (Sandbox Code Playgroud)

我想要做的是缩放宽度以便在屏幕底部整齐地并排放置(现在可以正常使用),但是高度也会自动缩放以匹配宽度.这可能吗?我不想使用setImageSource,因为它在图像按钮周围放置了一个边框.

android aspect-ratio imagebutton

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

如何检查字符串中的字母是否使用python大写?

我有一个像"asdfHRbySFss"的字符串,我想一次查看一个字符,看看哪些字母大写.我怎么能用Python做到这一点?

python capitalization

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

我如何在python中显示100个小数位的无理数?

我试图找到2到100个小数位的平方根,但它默认只显示为10,我怎么能改变这个?

python math decimal-point

16
推荐指数
2
解决办法
9896
查看次数

是否有一个快捷键在eclipse中找到一个函数?

假设我有一个名为simpleFunction()的函数; 我在我的程序中多次调用.我不想做一个ctrl + f来找到它,是否有更快的方式直接跳转到该功能?

eclipse android

5
推荐指数
2
解决办法
753
查看次数

Eclipse图形布局预览不见了

我曾经能够通过点击"图形布局"看到我的布局在eclipse中的样子预览,然后我可以点击另一个名为"main.xml"的标签,看看实际的xml代码.现在我有两个名为"Design"和"Source"的标签.我怎样才能再次回到旧视图?

eclipse layout android

4
推荐指数
2
解决办法
6181
查看次数

我如何以编程方式在/values/strings.xml文件中引用某些内容?

我在strings.xml文件中有一些项目,我想以编程方式进行更改,最初我是通过setText();调用来完成的,但现在我正在尝试将我的应用程序翻译成另一种语言,这意味着一切都需要在我的字符串中设置. xml文件.是否可以将我的应用程序的所有文本放入strings.xml并通过引用字符串名称以编程方式更改内容,而不是使用setText()函数调用?例如,我如何引用"GrandTotal"?

<string name="GrandTotal">Grand Total:</string>
<string name="choose_prompt">Choose a Mode</string>
Run Code Online (Sandbox Code Playgroud)

xml string android

4
推荐指数
2
解决办法
8570
查看次数

如何在Android中的SharedPreferences中存储整数数组?

我有一个名为Upval16的整数值,我希望存储在我的SharedPreferences中而不为每个创建单独的值,但SharedPrefernces不允许使用Array,最简单的方法是什么?声明看起来像这样:

Integer[] UpVal = new Integer[16];
Run Code Online (Sandbox Code Playgroud)

arrays android sharedpreferences

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

Scrollview不会以线性布局滚动到顶部

我有一个相当简单的滚动视图,当我向上滚动时,它不会一直滚动到屏幕顶部.

 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:myapp="http://schemas.android.com/apk/res/com.surreall.matchit"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads" 

    android:orientation="vertical"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:background="@drawable/background"
    android:id="@+id/main_layout2"
    >

<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
            android:orientation="vertical"
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_marginTop="1dp"
            android:layout_gravity="center" 
            android:id="@+id/board"
            android:layout_weight="6"
            android:baselineAligned="false"

            >     
        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_weight="1" 
            >

            <com.surreall.logo.SquareButton         
                android:layout_height="fill_parent"
                android:layout_width="0dip"          
                android:layout_weight="1"  >        
                <ImageView
                android:id="@+id/card1"
                android:layout_gravity="center"
                android:adjustViewBounds="true"
                android:scaleType="centerInside"
                android:layout_height="wrap_content"
                android:layout_width="0dp"          
                android:layout_weight="1" 
                android:layout_margin="4dp"
                /> </com.surreall.logo.SquareButton>

            <com.surreall.logo.SquareButton         
                android:layout_height="fill_parent"
                android:layout_width="0dip"          
                android:layout_weight="1"  >        
                <ImageView
                android:id="@+id/card2"
                android:layout_gravity="center"
                android:adjustViewBounds="true"
                android:scaleType="centerInside"
                android:layout_height="wrap_content"
                android:layout_width="0dp"          
                android:layout_weight="1" 
                android:layout_margin="4dp"
                /> </com.surreall.logo.SquareButton>
            <com.surreall.logo.SquareButton         
                android:layout_height="fill_parent"
                android:layout_width="0dip"          
                android:layout_weight="1"  >        
                <ImageView
                android:id="@+id/card3"
                android:layout_gravity="center"
                android:adjustViewBounds="true"
                android:scaleType="centerInside"
                android:layout_height="wrap_content"
                android:layout_width="0dp"          
                android:layout_weight="1" …
Run Code Online (Sandbox Code Playgroud)

android scrollview

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