小编Sha*_*adi的帖子

android渐变中的角度属性

我正在通过测试示例.对于某些图像背景,他们使用渐变,代码就像这样

<?xml version="1.0" encoding="utf-8"?>


  <shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:startColor="#ff0000"
        android:centerColor="#00ff00"
        android:endColor="#0000ff"
        android:angle="180"/>
    <corners android:radius="5dp" />
   </shape>
Run Code Online (Sandbox Code Playgroud)

在上面的xml我没有得到angle属性.但是当我angle稍微改变模式的值时,模式倾斜.谁能解释我究竟是如何运作的?

android gradient android-layout android-shape

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

存储密钥值对的最佳Java数据结构

可能重复:
Java Hashmap:如何从值获取密钥?
Java中的双向映射?

我想key value data structure用于Android应用程序.我可以使用Map<K,V>,但在Map我无法获得特定值的关键.

是否有任何良好的Java数据结构,我可以使用它来按值检索密钥,反之亦然.

java android

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

Android Google服务广告选择器setLatLngBounds()无效

我在我的应用程序中使用PlacePicker.突然间,它表现得很糟糕.当它发射时指向(0.0,0.0)lat lng.我不确定Google服务是否有所改变.早些时候它工作得很好,因为从3天开始它不起作用.

我在这做错了吗?

这是我如何启动活动.

private void launchPlacePicker(double latitude, double longitude) {
    try {
        showProgress(true);
        PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();

        Log.d(TAG, " launchPlacePicker " + latitude + " " + longitude);

        builder.setLatLngBounds(MapUtils.getLatLngBounds(new LatLng((double) latitude, (double) longitude)));

        startActivityForResult(builder.build(this), PLACE_PICKER_REQUEST);
    } catch (GooglePlayServicesRepairableException e) {
        showProgress(false);
        Log.e(TAG, "GooglePlayServicesRepairableException", e);
    } catch (GooglePlayServicesNotAvailableException e) {
        showProgress(false);
        Log.e(TAG, "GooglePlayServicesNotAvailableException", e);
    }
}
Run Code Online (Sandbox Code Playgroud)

这就是我创建LatLngBounds的方法

public static LatLngBounds getLatLngBounds(LatLng center) {
    double radius = 100;
    LatLng southwest = SphericalUtil.computeOffset(center, radius * Math.sqrt(2.0), 225);
    LatLng northeast = SphericalUtil.computeOffset(center, …
Run Code Online (Sandbox Code Playgroud)

android google-maps android-studio

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

android.intent.action.PACKAGE_ADDED BroadcastReceiver没有在JB 4.1上接收主题添加的意图

我在我的Android应用程序中使用BroadcastReceiver,我在JB 4.1上运行我的应用程序

在清单中我注册为

<receiver android:name=".ThemeInstalledBroadcastReceiver" android:enabled="true">
    <intent-filter android:priority="100">
        <action android:name="android.intent.action.PACKAGE_ADDED" />
        <action android:name="android.intent.action.PACKAGE_REMOVED" />
        <data android:scheme="package" />
    </intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)

当我安装任何应用程序时,ThemeInstalledBroadcastReceiver类被触发,但是当我安装一些主题时,ThemeInstalledBroadcastReceiver就不会被触发.但是当我在JB 4.2上运行它时,这个应用程序工作正常

我的接收器代码是这样的

public class ThemeInstalledBroadcastReceiver extends BroadcastReceiver {

    @Override
    public void onReceive(final Context context, final Intent arg1) {
        System.out.println("Mass_TC inside InstalledBroadcastReceiver res " + arg1.getAction().equals(Intent.ACTION_PACKAGE_ADDED) );
        System.out.println("Mass_TC apkid " + arg1.getData().getEncodedSchemeSpecificPart() + " intent : " + arg1);

    }

}
Run Code Online (Sandbox Code Playgroud)

我安装应用程序时记录日志

I/System.out(19647): Mass_TC apkid com.example.ttest intent : Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.example.ttest flg=0x8000010 cmp=com.myrrom.themechooser/.InstalledBroadcastReceiver (has extras) }
I/System.out(19647): Mass_TC deleting apkid …
Run Code Online (Sandbox Code Playgroud)

java android android-4.2-jelly-bean

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

我们可以在Facebook上更改链接的图像(由Android应用程序发布)

我们可以在Facebook上更改链接的图像(由Android应用程序发布)

我通过我的应用程序在FaceBook上发布了一些链接,但我想在Facebook墙上显示其他图像

我的代码是这样的

Intent shareCaptionIntent = new Intent(Intent.ACTION_SEND);
shareCaptionIntent.setType("image/png");
shareCaptionIntent.putExtra(Intent.EXTRA_STREAM, "<URL>");
//set caption
shareCaptionIntent.putExtra(Intent.EXTRA_TEXT, "example caption");
shareCaptionIntent.putExtra(Intent.EXTRA_SUBJECT, "example caption");
startActivity(Intent.createChooser(shareCaptionIntent,getString(R.string.share)));
Run Code Online (Sandbox Code Playgroud)

我也可以看到标题和描述.如何更改图像并使描述和标题可见,请查找附件图像在此输入图像描述

android facebook facebook-android-sdk

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

Android:无法为SharedPreferences文件创建目录

我正在尝试SharedPreferences通过另一个应用程序编辑一个应用程序,我的代码就像这样

try {
Context plutoContext = getApplicationContext().createPackageContext("me.test",Context.MODE_WORLD_WRITEABLE);
SharedPreferences plutoPreferences = PreferenceManager.getDefaultSharedPreferences(plutoContext);
Editor plutoPrefEditor = plutoPreferences.edit();
plutoPrefEditor.putString("country", "India");
plutoPrefEditor.commit();
}
Run Code Online (Sandbox Code Playgroud)

我收到了一个错误

E/SharedPreferencesImpl( 304): Couldn't create directory for SharedPreferences file /data/data/me.test/shared_prefs/me.test_preferences.xml

这里me.test是我在me.test凸出的另一个项目,我可以编辑和检索SharedPreferences具有无痛苦

我在Nexus S android 4.0.4(三星)上测试它,任何人都可以帮助我

android android-intent android-layout

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

避免在Android设备上的应用程序设置中单击"清除数据"按钮从数据库中删除数据

database用来存储一些data.但是当用户转到Apps Settings并按下'clear data'应用程序设置中的按钮时,数据库中的数据将被删除,以避免这种情况.我可以'clear data'在应用程序设置中将我的应用程序设为BUTTON,因为未启用或任何其他建议....

java database sqlite android

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

Android多个通知在点击时发送相同的数据

android中的通知在点击时采取相同的意图.我在安装主题后发送通知.考虑我安装了4个主题,4个通知出现在通知窗口中,但是当我点击每个通知时,它将启动特定活动,但意图是为每个意图提供相同的数据.

我的代码是这样的

    @SuppressWarnings("deprecation")
void sendInstalledNotification(String fileName, String packageName) {
    NotificationManager notificationManager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);

    String name = "";
    try {
        name += fileName.substring(fileName.lastIndexOf(".") + 1);
    } catch (Exception e) {
        Log.e("NewThemeChooser", "Invalid Package name");
        e.printStackTrace();
    }
    name += " Installed";
    Notification notification = new Notification(R.drawable.ic_launcher_9, name , System.currentTimeMillis());

    Intent intent = new Intent(mContext , ThemeInfo.class);
    Bundle bundle = new Bundle();
    bundle.putString("apkid", packageName);
    bundle.putBoolean("isApplied", false);
    intent.putExtra("bundle", bundle);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    PendingIntent pendingIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
    notification.setLatestEventInfo(mContext, name, "Click to Apply Theme", …
Run Code Online (Sandbox Code Playgroud)

android android-intent android-notifications android-notification-bar

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

在QT中更新XML文件

我有Xml文件

<root rootname="RName" otherstuff="temp">
     <somechild childname="CName" otherstuff="temp">
     </somechild>
</root>
Run Code Online (Sandbox Code Playgroud)

在上面的XML我怎么可以更新RNameRNCNameCN使用QT.我正在使用QDomDocument但不能做必需的事情.

xml qt xml-parsing

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

我在哪里可以在QT sdk中找到用于创建Qt安装程序的binarycreator

我正在创建Qt Installer一些QT应用程序,当我在某些时候通过Qt安装程序框架手册时,我发现朗姆酒请看图像binarycreator下面的图像,但我无法找到该二进制文件Qt SDK,请任何人都可以帮忙.

linux macos qt qt-installer

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