小编mad*_*mar的帖子

Android studio不显示新创建的目录

当我在"res"目录中创建一个新目录(例如:values-da)时,它不会显示我创建的目录.无论目录名称是什么.它只是不会显示.我再次重新创建了目录,它说该目录已经存在.我关闭程序并再次打开它,但我创建的目录仍未显示.

在此输入图像描述

android android-studio

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

在Android上移植C++ lib/app

我想将几个C/C++库移植到Android,它的可行性如何

例如OpenSSL可以移植或者假设一个依赖于OpenSSL的应用程序,当我认为自己拥有libssl.so时,将它移植到Android的最佳方式是什么?

什么是可用的工具,例如Scratchbox,任何替代品?有人有经验吗?

c c++ linux embedded android

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

用于ExpandableListView的android notifyDataSetChanged不起作用

在我的应用程序中我正在使用ExpandableListView.我正在使用扩展的适配器BaseExpandableListAdapter.我想刷新一下ExpandableListView.

ExpandableListView的项目包含与数据库链接的删除按钮.如果我按下删除按钮,该项将从db中永久删除.但listview同时并不令人耳目一新.如果我再次运行该活动,那么它是令人耳目一新的但不是同时.我在用

mAdapter.notifyDataSetChanged();
Run Code Online (Sandbox Code Playgroud)

但它没有按我的意愿工作.为什么?

android expandablelistview

6
推荐指数
2
解决办法
9189
查看次数

在Android上解码h264 ByteStream总是从dequeueOutputBuffer()获取INFO_TRY_AGAIN_LATER

尝试使用媒体编解码器对编码数据克数据包进行解码,但在dequeueOutputBuffer()中始终获得-1.

请帮帮我 - 我做错了什么?我试图在没有成功的情况下面对这个问题.

private void decodeVideo(){

    new Thread(new Runnable() {

        @Override
        public void run() {
            int n = 0;
            MediaFormat mediaFormat = new MediaFormat();
            mediaFormat.setString(MediaFormat.KEY_MIME, "video/avc");
            mediaFormat.setInteger(MediaFormat.KEY_MAX_INPUT_SIZE, 100000);
            mediaFormat.setInteger(MediaFormat.KEY_WIDTH,
                    surfaceView.getWidth());
            mediaFormat.setInteger(MediaFormat.KEY_HEIGHT,
                    surfaceView.getHeight());
            mediaFormat.setInteger(
                    MediaFormat.KEY_PUSH_BLANK_BUFFERS_ON_STOP, 1);
            mediaFormat.setInteger(MediaFormat.KEY_COLOR_FORMAT,
                    MediaCodecInfo.CodecCapabilities.COLOR_FormatL2);// TODO

            byte[] csd_info = { 0, 0, 0, 1, 103, 100, 0, 40, -84, 52, -59,
                    1, -32, 17, 31, 120, 11, 80, 16, 16, 31, 0, 0, 3, 3,
                    -23, 0, 0, -22, 96, -108, 0, 0, 0, 1, 104, -18, …
Run Code Online (Sandbox Code Playgroud)

android decode h.264 mediacodec

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

元数据标记没有正确的值

我是android的新手,我试图在我的应用程序中使用谷歌地图使用谷歌播放服务获取错误.

MapViewActivty:

public class MapsViewActivity extends FragmentActivity {
// Google Map
private GoogleMap googleMap;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.maps);

    try {
        // Loading map
        initilizeMap();

    } catch (Exception e) {
        e.printStackTrace();
    }

}

/**
 * function to load map. If map is not created it will create it for you
 * */
private void initilizeMap() {
    if (googleMap == null) {
        googleMap = ((MapFragment) getFragmentManager().findFragmentById(
                R.id.map)).getMap();

        // check if map is created successfully or not
        if (googleMap …
Run Code Online (Sandbox Code Playgroud)

xml android google-maps fragment

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

使用LayoutTransition动画工具栏

我想要实现的目标

我的应用程序Toolbar包含2个AutoCompleteTextView.我想仅在用户选择第一个时显示第二个,并且如果第一个被清除则再次隐藏它(我在AutoCompleteTextView清除它时有一个'X' ).

我希望Toolbar在这两种状态之间进行动画制作AutoCompleteTextView,在第一种状态中选择某些东西时将其扩展并在第二种状态中淡出,并在第二种状态被清除时淡出第二种状态AutoCompleteTextView并折叠Toolbar.

我尝试了什么,但没有奏效

我尝试使用LayoutTransition,在XML设置中android:animateLayoutChanges为true,在代码中声明LayoutTransition并将其设置为LinearLayout包含我的AutoCompleteTextViews.

我第一次尝试这种方式:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    style="@style/CategoryStyle.Vertical"
    tools:context=".MainActivity">

    <!-- TOOLBAR -->
    <android.support.v7.widget.Toolbar
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/toolbar_main"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        android:minHeight="?attr/actionBarSize"
        style="@style/ToolbarStyle">

        <!-- i set the LayoutTransition on THIS ONE -->
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:id="@+id/linear_toolbar">

            <!-- AUTOCOMPLETE market -->
            <com.mwd.shoppinglist.Utility.AutoCompleteTextViewNoFilter
                android:id="@+id/shop_chooser"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                style="@style/Autocomplete"
                android:hint="@string/chooseShop"
                android:textSize="16sp"
                android:drawableRight="@drawable/ic_action_cancel"/>

            <!-- AUTOCOMPLETE product -->
            <com.mwd.shoppinglist.Utility.AutoCompleteTextViewNoFilter
                android:id="@+id/item_chooser"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" …
Run Code Online (Sandbox Code Playgroud)

android android-animation android-toolbar

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

谷歌地图用毕加索自定义标记图像,刷新两次以显示图像

在我的谷歌地图为Android应用程序,我使用毕加索显示自定义标记图像,我必须刷新活动两次,以使其显示标记的自定义图像.第一次显示默认标记,然后当我刷新它时显示自定义标记.我怎样才能让它第一次显示自定义标记?

主要活动:

myMarker = mMap.addMarker(new MarkerOptions().position(new LatLng(Double.parseDouble(latitude), Double.parseDouble(longitude))).title(profile_icon).snippet());
PicassoMarker marker = new PicassoMarker(myMarker);
Picasso.with(MainActivity.this).load(icon_url).into(marker);
Run Code Online (Sandbox Code Playgroud)

PicassoMarker:

public class PicassoMarker implements Target {
Marker mMarker;

PicassoMarker(Marker marker) {
    mMarker = marker;
}

@Override
public int hashCode() {
    return mMarker.hashCode();
}

@Override
public boolean equals(Object o) {
    if(o instanceof PicassoMarker) {
        Marker marker = ((PicassoMarker) o).mMarker;
        return mMarker.equals(marker);
    } else {
        return false;
    }
}

@Override
public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {
    mMarker.setIcon(BitmapDescriptorFactory.fromBitmap(bitmap));

}

@Override
public void onBitmapFailed(Drawable errorDrawable) {
}

@Override …
Run Code Online (Sandbox Code Playgroud)

android google-maps google-maps-api-3 picasso

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

如何在 Android 中的另一个视图上设置文本动画?

我正在尝试在另一个视图上为一些文本“缩小”设置动画。我的代码看起来像:

class BoardView extends View {

private TextView animText;

...

private void animText(String text, int color, int xBlocks, int yBlocks) {
    animText.setText(text);
    animText.setTextColor(color);
    animText.setVisibility(View.VISIBLE);
    final int x = BOARD_X_OFFSET + xBlocks * xBlockSize;
    final int y = BOARD_Y_OFFSET + yBlocks * yBlockSize;
    final float SCALE_FROM = (float) 0.25;
    final float SCALE_TO = (float) 5.0;
    ScaleAnimation anim = new ScaleAnimation(SCALE_FROM, SCALE_TO, SCALE_FROM, SCALE_TO, x, y);
    anim.setDuration(500);
    animText.setAnimation(anim);
    this.setAnimation(null);
    startAnimation(anim);
}

}
Run Code Online (Sandbox Code Playgroud)

与animText在被调用onDraw()的程序BoardView。我所看到的,然而,这是董事会缩小,而不是文字,尽管上述呼吁setAnimation()

我查看了主要的 …

animation android android-animation

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

Android studio-向gradle添加签名配置

我对 android 世界很陌生,我试图在我的手机上运行一个简单的 hello world 应用程序。当我尝试这个时,我了解到由 android studio 生成的 APK 是未签名的。所以为了签署这个,我经历了创建一个密钥存储的过程,然后是一个私钥,它的别名,我成功地签署了 APK 并安装在我的手机上并运行它。

然后我通过这个链接将签名配置添加到 gradle 以使用新创建的密钥存储文件自动签署版本。我已经正确地按照上述链接的步骤操作并且没有遗漏任何东西,但是当我完成我的签名配置时,我有一个错误说

Gradle 项目同步失败。基本功能(例如编辑、调试)将无法正常工作。

错误:(19, 0) 在 SigningConfig 容器上找不到属性“config”。

我吃了一惊!现在我也无法手动签署我的 APK。现在,当我尝试手动签名时,它说 gradle不同步

我想这个文件将有助于帮助我解决这个错误。项目的 build.gradle。我试图理解这里提到的内容与我在进行签名配置时通过 Android Studio UI 配置的内容相同。

apply plugin: 'com.android.application'

android {
    signingConfigs {
        release {
            storeFile file("<path>\\firstKeystore.jks")
            storePassword "******"
            keyAlias "usual password"
            keyPassword "******"
        }
    }
    compileSdkVersion 19
    buildToolsVersion '20.0.0'
    defaultConfig {
        applicationId 'com.tech.vasanth.newsfeed'
        minSdkVersion 19
        targetSdkVersion 19
        versionCode 1
        versionName '1.0'
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), …
Run Code Online (Sandbox Code Playgroud)

android code-signing android-install-apk android-studio

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

简单的 Android BLE 扫描仪

我正在尝试创建一个简单的 android 应用程序,我可以使用它扫描低功耗蓝牙 (BLE) 设备并将名称打印为日志。主要活动是非常基本的,我不需要检查,我想这没问题。扫描开始,但我没有结果。

清单文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.s1080994.tid.findble">


    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />


    <uses-feature
        android:name="android.hardware.bluetooth_le"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
Run Code Online (Sandbox Code Playgroud)

主活动.java

public class MainActivity extends AppCompatActivity {

    private BluetoothAdapter mBluetoothAdapter  = null;
    private BluetoothLeScanner mBluetoothLeScanner = null;

    public static final int REQUEST_BT_PERMISSIONS = 0;
    public static final int REQUEST_BT_ENABLE = 1;

    private boolean mScanning = false;
    private Handler mHandler …
Run Code Online (Sandbox Code Playgroud)

android bluetooth bluetooth-lowenergy

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