小编Shr*_*jan的帖子

为什么我的相机预览显示水平而不是垂直?

在我的Android相机应用程序中,如果我将屏幕固定到横向,那么在横向模式下,它似乎必须被看到.但如果我将它固定到肖像,那么相机预览将被视为水平.它为什么会发生?什么是溶剂呢?

android android-layout android-camera

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

如何删除模拟器SDCard上保存的文件?

在我的应用程序中,我将把文件从资产存储到SDCard.但现在模拟器中没有更多的空间了.所以我想删除该文件.

那么如何从模拟器中删除该文件?

android android-emulator android-sdcard

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

如何给HashMap提供静态值?

我有HashMap像:

static HashMap<String,ArrayList<Media>> mediaListWithCategory=new HashMap<String,ArrayList<Media>>();
Run Code Online (Sandbox Code Playgroud)

我有价值:

January:
   -Sunday
   -Monday
Februsry:
   -Saturday
   -Sunday
   -Thursday
March:
   -Monday
   -Tuesday
   -Wednesday
Run Code Online (Sandbox Code Playgroud)

在定义哈希映射时如何静态分配这些值?

java android android-widget android-emulator android-layout

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

Android:为什么我在点击一下按钮点击后无法播放声音?

我做过如果用户点击按钮然后声音正在播放.但是现在我点击后无法发出水声.我不知道为什么?

这是我用来播放声音的代码.

码:

case R.id.lockView:
        playSound(R.raw.dooropen);
        break;
    }

public void playSound(int resources){
    boolean mStartPlaying = true;
    if (mStartPlaying==true){
        mPlayer = new MediaPlayer();
        Uri uri = Uri.parse("android.resource://com.project.iMystick/" + resources);
        try{
            mPlayer.setDataSource(getApplicationContext(),uri);
            mPlayer.prepare();
            mPlayer.start();
        } 
        catch (IOException e){
            Log.e(LOG_TAG, "prepare() failed");
        }
    } 
    else{
       //   stopPlaying();
        //rePlay.setText("Replay");
        mPlayer.release();
        mPlayer = null;
    }
    mStartPlaying = !mStartPlaying;
}
Run Code Online (Sandbox Code Playgroud)

点击一下后,我在logcat中收到了这种类型的错误信息:

日志:

03-27 16:15:02.737: ERROR/MediaPlayer(1057): Error (-19,0)
03-27 16:15:03.858: DEBUG/AudioSink(34): bufferCount (4) is too small and increased to 12
03-27 16:15:03.858: ERROR/AudioFlinger(34): not enough memory for …
Run Code Online (Sandbox Code Playgroud)

audio android media-player android-ndk

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

ScrollView上的Android PullTo Refresh

我知道iPhone中可以使用pullToRefresh功能,对于Android我们必须手动管理它.

我得到了一些示例有pullToRefresh但它只适用于ListView.

在我的情况下,我想为Scrollview实现.像Google Play中的DrawFree应用程序中的PullToRefresh.

请看下面的图片:

在此输入图像描述

那么,如何实现呢?

任何实现它的例子都会非常感激.

提前致谢.

android scrollview android-widget android-layout

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

Android列表视图不滚动

我有一个其起始标签(父标签是)的布局

<scroll view  
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
Run Code Online (Sandbox Code Playgroud)

后来我有很多图像,textView,编辑文本和其他东西,最后是列表视图.我已经按照规定将listview的高度定义为230dp.事情是整个布局滚动不错,但listview内的内容不是单独滚动.这就是xml看起来的样子......

    <ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
     > 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:orientation="vertical" >
    <TextView android:layout_width="fill_parent"
         android:layout_height="50dp"
         android:text="BISCOOT"
         android:textSize="25dp"
         android:background="@drawable/item_bg_light"
         android:textColor="@android:color/white"
         android:gravity="center"/>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" android:layout_width="fill_parent" 
     android:layout_height="200dp" android:background="#ff000000">

      <ImageSwitcher android:id="@+id/switcher1" android:layout_width="fill_parent" 
      android:layout_height="200dp"  
      android:layout_alignParentLeft="true" android:layout_alignParentRight="true" >
      </ImageSwitcher> 
        <ProgressBar
              android:id="@+id/progressBar2"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"  android:layout_centerHorizontal="true"
               />
        <ImageButton android:id="@+id/imageButton1" android:layout_width="wrap_content"
       android:layout_height="wrap_content" android:layout_alignParentRight="true" 
       android:layout_centerVertical="true" android:src="@android:drawable/ic_media_ff" /> 

        <ImageButton android:id="@+id/imageButton2" android:layout_width="wrap_content" 
      android:layout_height="wrap_content" android:layout_alignParentLeft="true" 
      android:layout_alignTop="@+id/imageButton1" android:src="@android:drawable/ic_media_rew" /> 
  </RelativeLayout>
    <TextView android:layout_width="fill_parent"
         android:layout_height="30dp"
         android:text="Latest headLines"
         android:background="@drawable/item_bg_light"
         android:textColor="@android:color/white"
         android:gravity="center"/>
    <ProgressBar
        android:id="@+id/progressBar1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center" />
         <LinearLayout android:orientation="vertical"
             android:layout_width="fill_parent" …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-listview android-scrollview android-scroll

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

为什么图像上的油漆会变慢?

在我的Android绘图应用程序中,我将在画布上绘画.但有些时候我在画之前就有了Image.那时我的油漆变慢了.问题出在哪儿 ??

仅在Canvas上绘制的代码:

@Override
    protected void onDraw(Canvas canvas) {

        //canvas.drawColor(0, PorterDuff.Mode.CLEAR);
        // set the Canvas Color
        canvas.drawColor(canvasColor); // edited

        canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint); 

        canvas.drawPath(mPath, mPaint);

    }
Run Code Online (Sandbox Code Playgroud)

将图像作为背景的代码是:

 @Override
    protected void onDraw(Canvas canvas) {

        //canvas.drawColor(0, PorterDuff.Mode.CLEAR);
        // set the Canvas Color
        canvas.drawColor(canvasColor); // edited

        if(!(imagePath==null))
        {
            Bitmap tempBitmap = BitmapFactory.decodeFile(imagePath); // from the gallery
            photoBitmap = Bitmap.createScaledBitmap(tempBitmap, display.getWidth(), display.getHeight(), true);
        }
        if(!(imagePath==null))
        {
            canvas.drawBitmap (photoBitmap,0,  0, null);
        }


        canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint); 
     canvas.drawPath(mPath, mPaint);

    }
Run Code Online (Sandbox Code Playgroud)

现在我不知道为什么我的油漆变得很慢,而我在画布上画画,如果有图像作为背景.请帮帮我.谢谢.

android paint android-layout android-canvas

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

Android:日历不提供全年编号,只提供111而不是2011年

我使用以下代码获取当前设备时间的年份:

Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
cal.getTime().getYear();
Run Code Online (Sandbox Code Playgroud)

但随着时间的推移,我将获得111而不是2011年.

如果我将2012年定为当年,那么它给我112而不是2012.

为什么会这样?请帮助我.谢谢.

time android emulation android-emulator

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

如何为下面的ArrayList创建Next和Previous按钮代码?

我已经制作了ArrayList并通过coading逐个添加值.我能够看到整个arrayList如下面的代码:

//  TO DISPLAY DATA
                for(int j=0;j<tempEmployerList.size();j++)
                {
                    System.out.println("================ Employee: "+(j+1)+"======================");
                    m = new Employer();
                    m=tempEmployerList.get(j);
                    //System.out.println("TaxCodeHeading: "+(j+1)+" = "+m.getOrderName());
                    System.out.println("TaxCode: "+(j+1)+" = "+m.getTaxcode());
                    System.out.println("PayPeriod: "+(j+1)+" = "+m.getPayPeriod());
                    System.out.println("Frequency: "+(j+1)+" = "+m.getPayFrequency());
                    System.out.println("Salary/Wage: "+(j+1)+" = "+m.getSalaryWage());
                    System.out.println("NetGross Amount: "+(j+1)+" = "+m.getNetGrossAmount());
                    System.out.println("KiwiSaverMember: "+(j+1)+" = "+m.getKiwiSaverMember());
                    System.out.println("Employee Deduction: "+(j+1)+" = "+m.getEmployeeDeduction());
                    System.out.println("Complying Fund Member: "+(j+1)+" = "+m.getComplyingFundMember());
                    System.out.println("Fund Contribution: "+(j+1)+" = "+m.getFundContribution());
                    System.out.println("ESCT Tax Rate: "+(j+1)+" = "+m.getESCTTaxRate());
                    System.out.println("Child Support Deduction: "+(j+1)+" = "+m.getChildSupportDeduction());
                    System.out.println("Payroll giving Donation: "+(j+1)+" = "+m.getPayrollDonation());
                } …
Run Code Online (Sandbox Code Playgroud)

arrays android arraylist android-widget android-layout

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

android的abc.db和abc.sqlite有什么区别?

我见过很多android数据库应用程序.

某些应用程序的数据库扩展名为.sqlite,而某些应用程序的扩展名为.db.

这两者有什么区别?它应该包含不同的东西吗?

请帮助我.

什么应该是最好用于Android数据库?

谢谢.

database sqlite android metadata

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