相关疑难解决方法(0)

如何以编程方式在android中添加主屏幕快捷方式

我在开发Android应用程序时出现了这个问题.我想到分享我在开发过程中收集到的知识.

android homescreen

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

为网站创建Android启动图标

我有一个响应式网站,可以跨多个设备访问,我们的设计和应用程序主要针对移动用户.

为了便于访问该网站,我们希望创建一个启动图标,该图标将显示在移动主屏幕上,用户可以通过一键式访问该网站,而不是启动浏览器并键入URL /打开已添加书签的页面.

我在IOS中找到了一个解决方案,它也受到safari浏览器的支持,您可以使用它来保存页面URL作为启动图标,可以在Android设备上找到类似的功能吗?我还有兴趣提示用户如果从手机/平板电脑访问它,则创建启动图标.

android launcher

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

两个发射器用于单个活动

是否可以使用多个应用程序图标以不同的意图附加功能启动相同的活动?

android android-intent android-activity

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

Android Widget看起来与启动器图标完全相同

我在使用小部件时遇到了困难.从http://developer.android.com/guide/practices/ui_guidelines/widget_design.html#cellstable上读取下表:

  • 1个细胞 - 40dp
  • 2个细胞 - 110dp
  • ...
  • n细胞--70×n - 30 dp

所以我的小部件想要看起来像一个发射器,它将minHeigth和minWidth作为40dp.到目前为止,我所做的是使用图标作为启动器,192px,144px,96px,72px和48px.

但我无法获得作为图标发射器的确切感觉(文字风格,动人风格......).我可以尝试猜测但是......在哪里可以找到启动器布局的源代码?我找不到它.在与其他图标进行比较时,查看小部件的外观:

在此输入图像描述

我想尝试的另一件事是制作绿色图标以填充所有单元格(作为背景),然后填充另一个图像和文本.我也不能让它看起来不错,我想知道唯一的方法是在这里使用9patch图像......

到目前为止,这是我的小部件布局代码:

<LinearLayout   xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical">

  <ImageView
    android:id="@+id/appwidget_button"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:layout_gravity="center_horizontal"
    android:layout_weight="1"
    android:src="@drawable/widget_1_background"/>

  <TextView
    android:id="@+id/appwidget_text"
    android:typeface="sans"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal"
    android:textColor="@android:color/white"
    android:textSize="12sp"
    android:singleLine="true"/>

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

建议?

android widget android-widget android-layout android-launcher

11
推荐指数
0
解决办法
868
查看次数

Android:是否有一种在主屏幕上创建Web快捷方式的编程方式

您知道在手机用户的主屏幕上是否有以编程方式创建Web快捷方式?

我想做的是:

当手机用户点击我们的Android应用程序中的按钮时,应用程序将把网站快捷方式放到手机用户的主屏幕上.

android

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

通过Intent在Android中创建快捷方式

可能重复:
Android在主屏幕上创建快捷方式

我有一个TextViewButton我的Activity(HomeActivity.class).

目标:当我点击Button它时,它应该创建一个快捷方式,默认的android图像作为图标和文本输入TextView.

到目前为止,我发现我们可以使用创建快捷方式 ACTION_CREATE_SHORTCUT

这是我到目前为止的代码:

Intent result = new Intent(android.content.Intent.ACTION_CREATE_SHORTCUT);
result.putExtra(Intent.EXTRA_SHORTCUT_INTENT,
                new Intent(getApplicationContext(), Editor.class));
result.putExtra(TodoDbAdapter.KEY_ROWID,rowid);
result.putExtra(Intent.EXTRA_SHORTCUT_NAME,textView.getText());
result.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE,
                Intent.ShortcutIconResource.fromContext(HomeActivity.this,
                                                        R.drawable.icon));
setResult(RESULT_OK, result);
Run Code Online (Sandbox Code Playgroud)

我的清单文件:

<activity android:name=".HomeActivity" android:label="@string/app_name">

        <intent-filter>
                <action android:name="android.intent.action.CREATE_SHORTCUT" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
Run Code Online (Sandbox Code Playgroud)

但是这段代码不会创建任何快捷方式.

我该如何创建快捷方式?

android homescreen android-layout

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

从其他应用程序添加HomeScreen WebApps?

使用Chrome,您可以Add to home screen从菜单中添加HomeScreen Web Apps .我想制作一个通过传递URL来生成HomeScreen Web Apps的应用程序.

适用于Android的Chrome

是否可以从与Chrome不同的其他应用程序添加HomeScreen Web App?

android

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

我想创建快捷方式

我在打开应用程序时创建快捷方式,但问题是创建一个总是打开应用程序的快捷方式,如果我打开应用程序20次然后创建20个快捷方式

我需要只创建一个第一次打开的快捷方式而不是更多

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    ShortcutIcon();

   }




private void ShortcutIcon(){

    Intent shortcutIntent = new Intent(getApplicationContext(), Main.class);
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "Whatsapp Imagenes");
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(getApplicationContext(), R.drawable.icono));
    addIntent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
    getApplicationContext().sendBroadcast(addIntent);
}
Run Code Online (Sandbox Code Playgroud)

android

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