小编nAk*_*dov的帖子

移动设备中的Google Map

在我的应用程序中,我使用了地图 http://maps.google.com/maps?q=

问题是Android有一个标签"A",但iPhone有地址.当我在iPhone中点击Pin标签"获取路线"时,该页面确实包含实际的街道地址,但Android却没有.

据我所知,iPhone有自己的应用程序,以显示地图,但Android显示在浏览器中.

有没有办法管理Android的地图?

javascript iphone android google-maps

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

androidannotations @AfterViews没有调用并且editText为null

我有一个课程,它是从Fragment扩展的。在一个类中,我的editText为null,并且@AfterViews没有调用,这是我的代码:

@EFragment
public class Search extends Fragment {

private final String TAG = Search.class.getCanonicalName();
private static ProgressDialog progressDialog;
private Activity activity;
private ArrayList<String> urlList = new ArrayList<String>();

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.search, container, false);
    Log.i(TAG, "onCreateView");
    return rootView;
}
@ViewById
RadioButton firstRadio;

@ViewById
RadioButton secondRadio;

@ViewById(R.id.editText1)
EditText editText1;

@AfterViews
void afterViews() {
    int a = 1;
    a++;
    Log.i(TAG, editText1 + "AfterViews");
    Log.i(TAG, a + "aaaaaaaa");
}

private void extractUrlsFromText(String s) { …
Run Code Online (Sandbox Code Playgroud)

xml android android-annotations

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

android如何在webview中显示PopupMenu,就像GMail一样

我想在我的应用程序中像GMail一样在webview中显示PopupMenu.

在此输入图像描述

这是我的代码:

webView.addJavascriptInterface(new WebAppInterface(getActivity()), "ScriptToAndroid");

<div class="moreover_icon" onclick="showPopup('file_attach_path', event)">
    <img class="overflow_icon" src="android_moreover_icon"/>
</div>

<script type="text/javascript">

    function showPopup(file_path, event) {
        ScriptToAndroid.showPopupDialog(file_path, pos_x, pos_y);
    }
</script>

@JavascriptInterface
public void showPopupDialog(String filePath, int x, int y) {
    //show PopupMenu
}
Run Code Online (Sandbox Code Playgroud)

javascript html5 android popupmenu webview

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

android从html文本创建pdf文件

这是我的代码,用于将 html 转换为 pdf:

public boolean create (String htmlText, String absoluteFilePath) {
try {
    Document document = new Document(PageSize.LETTER);
    PdfWriter pdfWriter = PdfWriter.getInstance
            (document, new FileOutputStream(absoluteFilePath));
    document.open();

    // Fixing xhtml tag
    Tidy tidy = new Tidy(); // obtain a new Tidy instance
    tidy.setXHTML(true); // set desired config options using tidy setters
    ByteArrayOutputStream output = new ByteArrayOutputStream();
    tidy.setCharEncoding(Configuration.UTF8);
    tidy.parse(new ByteArrayInputStream(htmlText.getBytes(), output);
    String preparedText = output.toString("UTF-8");

    Log.i("CHECKING", "JTidy Out: " + preparedText);

    InputStream inputStream = new ByteArrayInputStream(preparedText.getBytes());
    XMLWorkerHelper.getInstance().parseXHtml(pdfWriter, document,
            inputStream, null, Charset.forName("UTF-8"), …
Run Code Online (Sandbox Code Playgroud)

html pdf android itext

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

android gradle本地路径不存在

当我每次运行我的应用程序时,versionName在Manifest文件中递增. 20389表示旧版本名称,20390表示递增编号.

在此输入图像描述

项目建立成功,如BUILD SUCCESSFUL.但问题是为什么Android studio会缓存以前的apk版本.这是什么错误:

目标设备:lge-nexus_5-061642fd00511249上传文件本地路径:H:\ customFolder\app\build\outputs\apk\MyAppName-0.6.200_20383-debug.apk远程路径:/data/local/tmp/com.example.app本地路径不存在.

当应用程序在设备上运行时你注意,android studio尝试安装20383版本的apk.这是错误的.谁能帮助我?我已经googeled并看到了这个链接.

以下是我可以使用gradle脚本更改清单文件的方法:

def updateRevisionNumber () {//autoIncrement Version Name
  def currentVersion = getVersionName();
  def currentRevisionInManifest =           currentVersion.substring(currentVersion.indexOf("_")+1);
  def lastRevision = Integer.parseInt(currentRevisionInManifest) + 1;
  println("currentRevisionInManifest: " + currentRevisionInManifest);
  println("lastRevision: " + lastRevision);

  def oldText = manifestFile.getText();
  def changedText =      oldText.replace(currentRevisionInManifest,lastRevision+"");
  manifestFile.setText(changedText);}
Run Code Online (Sandbox Code Playgroud)

android build gradle android-studio

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

android发送https post请求到服务器没有弃用的metods

在我的应用程序中使用https发送请求,遵循此源答案.现在他们中的一些apache方法已被弃用.任何人都可以帮我解决一个新的方法吗?

ssl https post android request

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

Jetpack Compose RememberSwipeableState 在列表更新时保存旧状态

我有一个按类别显示项目的列表。如果我选择第一个类别并将第一个项目向左滑动,然后将一个类别更改为另一个类别。新列表正在更新,但第一个项目在新列表 ui 上保持滑动状态,应将所有可滑动项目显示为默认状态。类别更改时如何设置默认滑动状态?

@OptIn(ExperimentalMaterialApi::class)
@Composable
  fun SwipeRevealDismissItem(
     context: Context,
     itemDataClass: itemDataClass,
     onDelete: (itemDataClass: itemDataClass) -> Unit,
     isEnabled: Boolean,
     defaultState: Int = SwipeState.DEFAULT.value,
     onItemSelected: ((itemDataClass?) -> Unit)? = null,
     content: @Composable () -> Unit
     ) {
         val swipeState = rememberSwipeableState(
             initialValue = defaultState,
         )
         val scope = rememberCoroutineScope()

Box(
    modifier = Modifier
        .fillMaxWidth()
        .wrapContentHeight()
        .swipeable(
            state = swipeState,
            anchors = mapOf(
                0f to SwipeState.DEFAULT.value,
                -Utils
                    .dp2px(128, context)
                    .toFloat() to SwipeState.SWIPED.value,
            ),
            thresholds = { _, _ ->
                FractionalThreshold(0.3f)
            },
            orientation = …
Run Code Online (Sandbox Code Playgroud)

android swipe-gesture android-jetpack-compose

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

android 如何在用户点击通知时启动活动?

我想在用户单击通知时打开活动。我知道这个问题是重复的,但找不到解决方案,这就是我所做的

NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.notification_icon)
.setContentTitle("My notification")
.setContentText("Hello World!");

Intent resultIntent = new Intent(this, ResultActivity.class);

// Because clicking the notification opens a new ("special") activity, there's
// no need to create an artificial back stack.
PendingIntent resultPendingIntent =
    PendingIntent.getActivity(
    this,
    0,
    resultIntent,
    PendingIntent.FLAG_UPDATE_CURRENT
);

mBuilder.setContentIntent(resultPendingIntent);
// Sets an ID for the notification
int mNotificationId = 001;
// Gets an instance of the NotificationManager service
NotificationManager mNotifyMgr = 
    (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
// Builds the notification and issues it.
mNotifyMgr.notify(mNotificationId, mBuilder.build()); …
Run Code Online (Sandbox Code Playgroud)

notifications android android-pendingintent

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

android billing inApp/subscription 无法找到显式活动 ProxyBillingActivity

我想实现订阅计费功能,但是当我调用launchBillingFlow方法时,出现这样的错误

android.content.ActivityNotFoundException:无法找到显式活动类 {com.calendargb/com.android.billingclient.api.ProxyBillingActivity};您是否在 AndroidManifest.xml 中声明了此活动

这是我的样本

  BillingFlowParams purchaseParams = BillingFlowParams.newBuilder()
                    .setSku(skuId).setType(billingType).setOldSku(oldSku).build();
  mBillingClient.launchBillingFlow(mActivity, purchaseParams);
Run Code Online (Sandbox Code Playgroud)

我应该ProxyBillingActivity在清单文件中明确声明吗?提前致谢!

android in-app-purchase recurring-billing android-billing

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

Android如何在隐藏视图时使用自动布局移动其他视图?

当其中一个被隐藏时,我想制作可调整大小的视图。已经在以下链接中针对 iOS 提出了该问题。我想为Android制作它。任何帮助表示赞赏。我想在将可见性隐藏到计数和折扣后为三个 TextViev 添加可用空间:位置、统计名称、价格

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

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="1dp"
    android:gravity="center"
    android:orientation="horizontal"
    android:paddingBottom="10dp"
    android:paddingLeft="5dp"
    android:paddingTop="30dp"
    android:weightSum="100" >

    <TextView
        style="@style/list_titles_style"
        android:layout_weight="10"
        android:text="@string/position" />

    <TextView
        style="@style/list_titles_style"
        android:layout_weight="35"
        android:paddingLeft="15dp"
        android:text="@string/stat_name" />

    <TextView
        style="@style/list_titles_style"
        android:layout_weight="20"
        android:text="@string/price" />

    <TextView
        android:id="@+id/count_label"
        style="@style/list_titles_style"
        android:layout_weight="10"
        android:visibility="invisible"
        android:text="@string/count" />

    <TextView
        android:id="@+id/discount_label"
        style="@style/list_titles_style"
        android:visibility="invisible"
        android:layout_weight="25"
        android:text="@string/discount" />
</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginBottom="2dp"
    android:layout_marginLeft="2dp"
    android:layout_marginRight="2dp"
    android:layout_marginTop="1dp"
    android:background="@drawable/border_layout"
    android:orientation="horizontal" >

    <ListView
        android:id="@+id/stats_listview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="10dp"
        android:layout_marginBottom="5dp"
        android:divider="@drawable/list_divider"
        android:dividerHeight="2dp"
        android:paddingBottom="0dp"
        android:paddingLeft="10dp"
        android:paddingTop="0dp" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我的风格是:

<style name="list_titles_style">
    <item name="android:layout_width">0dp</item> …
Run Code Online (Sandbox Code Playgroud)

xml hidden android view

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

Qt QML在显示StackView页面时聚焦项目(文本字段)

我想在加载qml文件时启用TextField焦点。但是,它不起作用。加载TestUi.qml文件后,我放了一些按钮,并使用了onClick方法(我做了receiveView.focus = true),效果很好。问题在于,首次加载视图时未启用默认焦点。

TestUi.qml

import QtQuick 2.0
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.0


Page {

    function init() {
        recipientView.focus = true;
    }

    TextField {
       id: recipientView
        Layout.fillWidth: true
        font.pixelSize: 18
        inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhEmailCharactersOnly
        focus: true
        placeholderText: "Email"

    }
}
Run Code Online (Sandbox Code Playgroud)

main.qml

onComposeBtnClicked: {
    rootStackView.push(test)
    test.init()
}

TestUi {
    id: test
    visible: false
}
Run Code Online (Sandbox Code Playgroud)

qt focus qml stackview

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