小编Pra*_*ani的帖子

在单选按钮组中选择单选按钮必须启用textview并选择单选按钮,因为no必须在android中禁用textview

在单选组中选择单选按钮为YES必须启用textview并选择单选按钮,因为NO必须禁用android中的textview.

谁能解释我怎么能这样做?

布局代码:

<RadioGroup
    android:id="@+id/rg5"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="right"
    android:orientation="horizontal" >

    <RadioButton
        android:id="@+id/rg5r1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:checked="true"
        android:text="NO" />

    <RadioButton
        android:id="@+id/rg5r2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="YES" />

</RadioGroup>

<TextView
    android:id="@+id/q6"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:padding="10dp"
    android:text="If &apos;Yes&apos; please list allergies"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:textColor="@color/wight" />
Run Code Online (Sandbox Code Playgroud)

android radio-group

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

将<script>中的字符串插入<a href="">

我有以下脚本:

<script>var b=document;var c=varName;b.write(c);</script>
Run Code Online (Sandbox Code Playgroud)

我想将<script>标记中的值传递name给链接中的URL参数,而不是*这里:

`<a href="whatsapp://send?text='Hello This is My Demo Site. Visit http://example.com/ex.html?name=ABC*'"> WhatsApp </a>`
Run Code Online (Sandbox Code Playgroud)

我的尝试导致获取整个脚本字符串:

<a href="whatsapp://send?text='Hello This is My Demo Site. Visit http://example.com/ex.html?name=ABC<script>var b=document;var c=varName;b.write(c);</script>'"> WhatsApp </a>

html javascript href

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

如何在 Android Studio 中自动替换为 lambda 表达式

我在 Android Studio 中启用了 lambda 表达式并且它工作正常,但是每次我使用快捷方式写下一个新界面时,它以 Java-8 之前的形式而不是 lambda 表达式显示,我每次都必须手动替换它。 !

有没有办法让 Android Studio 自动替换 lambda 表达式?

看这里我的意思=>

在此处输入图片说明

java lambda android intellij-idea android-studio

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

适用于AndroidX AppCompat软件包的Proguard规则

到目前为止,我正在使用AppCompat库,但现在我已将项目迁移到AndroidX库。

我坚持使用androidx的 proguard规则

如您所知,我们正在对AppCompat使用proguard规则,如下所示:

-keep public class android.support.v7.widget.** { *; }
-keep public class android.support.v7.internal.widget.** { *; }
-keep public class android.support.v7.internal.view.menu.** { *; }

-keep public class * extends android.support.v4.view.ActionProvider {
    public <init>(android.content.Context);
}
Run Code Online (Sandbox Code Playgroud)

我已经搜索了很多,但是没有找到任何合适的文档。

AndroidX Proguard规则是否有任何更新?

android proguard android-appcompat android-proguard androidx

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

Android:英特尔 x86 仿真器加速器 HAXM 安装程序 - “修订版:7.5.6”更新失败

最近,我安装了Android Studio 3.6.1,我得到了更新 SDK 和其他工具的建议。

我正在尝试更新Intel x86 Emulator Accelerator(HAXM 安装程序)(修订版:7.5.6)但遇到如下问题:

Packages to install: 
- Intel x86 Emulator Accelerator (HAXM installer) (extras;intel;Hardware_Accelerated_Execution_Manager)
Preparing "Install Intel x86 Emulator Accelerator (HAXM installer) (revision: 7.5.6)".
Downloading http://dl.google.com/android/repository/extras/intel/haxm-windows_v7_5_6.zip
"Install Intel x86 Emulator Accelerator (HAXM installer) (revision: 7.5.6)" ready.
Installing Intel x86 Emulator Accelerator (HAXM installer) in E:\Android\Android\sdk\extras\intel\Hardware_Accelerated_Execution_Manager
"Install Intel x86 Emulator Accelerator (HAXM installer) (revision: 7.5.6)" complete.
Failed to update status to COMPLETE
"Install Intel x86 Emulator Accelerator (HAXM installer) (revision: …
Run Code Online (Sandbox Code Playgroud)

android android-emulator android-studio haxm android-studio-3.6

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

如何使用SimpleCursorAdapter更改特定行的背景

我正在尝试根据我的SQLite DB中的信息创建一个列表视图.我目前设置的代码只是相应地显示每一行,并用数据填充3个textviews.我希望能够使用某种If语句来检查其中一个值是否为"Room1",然后将该行的背景设置为某种颜色.

这样,列表中的每一行将根据数据的"空间"具有不同的背景.

我试过扩展SimpleCursorAdapter,但是我对如何得到我想要的东西感到有点迷茫.

以下是我目前对SimpleCursorAdapter的看法:

Cursor notesCursor = myDbHelper.fetchDayPanelNotes(type, day);
startManagingCursor(notesCursor);
String[] from = new String[]{DataBaseHelper.KEY_NAME, DataBaseHelper.KEY_ROOM, DataBaseHelper.KEY_TIME};

int[] to = new int[]{R.id.text1, R.id.text2, R.id.text3};

SimpleCursorAdapter notes = new SimpleCursorAdapter(this, R.layout.main_row, notesCursor, from, to);
setListAdapter(notes);
Run Code Online (Sandbox Code Playgroud)

android listview simplecursoradapter

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

更改文本颜色Spinner项目显示

我使用简单的游标适配器为微调器设置适配器,因为我使用了sqlite数据库.但我无法自定义微调器的字体颜色,

图片

这是我的微调器的Url有深红色背景我想使用简单的光标适配器与spinner android将文本颜色更改为白色

代码:

    Cursor cursor = dbAdapter.getAllData();

    if(cursor.getCount()>0){
    String[] from = new String[]{"columm_name"};
    // create an array of the display item we want to bind our data to
    int[] to = new int[]{android.R.id.text1};
    SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, cursor, from, to);

    mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    spinnerName.setAdapter(mAdapter);
Run Code Online (Sandbox Code Playgroud)

android spinner

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

RecyclerView适配器Lint错误不会将位置视为已修复

我有这种类型的错误,但我没有得到我能做的事情.

我得到了以下lint错误.

不要把位置视为固定; 只能立即使用并调用holder.getAdapterPosition()以便稍后查找.

当项目的位置在数据集中发生变化时,RecyclerView不会再次调用onBindViewHolder,除非项目本身无效或无法确定新位置.因此,您只应在获取此方法中的相关数据项时使用position参数,并且不应保留它的副本.

如果您稍后需要某个项目的位置(例如,在单击侦听器中),请使用具有更新的适配器位置的getAdapterPosition().

我的RecyclerView适配器:

   /**
     * Right Content Adapter
     */
    public class RightContentAdapter
            extends RecyclerView.Adapter<RightContentAdapter.ViewHolder> {

        public final ArrayList<IdNamePair> mValues;
        public Activity context;
        private int pos;

        public RightContentAdapter(Activity context, ArrayList<IdNamePair> items) {
            mValues = items;
            this.context = context;

        }

        @Override
        public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
            View view = LayoutInflater.from(parent.getContext())
                    .inflate(R.layout.activity_filter_checkbox, parent, false);

            Log.logInfo("onCreateViewHolder call");

            return new ViewHolder(view);
        }

        @Override
        public void onBindViewHolder(final ViewHolder holder, final int position) {
            final IdNamePair idNamePair = mValues.get(position);
            holder.onBind = …
Run Code Online (Sandbox Code Playgroud)

android android-adapter android-checkbox android-recyclerview

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

Firebase:无法解决错误:(26,13)无法解决:com.google.firebase:firebase-core:9.0.2

我正在使用Firebase创建我的第一个应用程序.

我一步一步地在我的应用程序中添加firebase.

完成所有步骤后,我遇到了以下错误.

在此输入图像描述

我的build.gradle文件:

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.google.firebase:firebase-core:9.0.2'
    compile 'com.google.firebase:firebase-messaging:9.0.2'
}


apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

我还在Project level build.gradle中添加了以下行.

classpath 'com.google.gms:google-services:3.0.0'
Run Code Online (Sandbox Code Playgroud)

有什么问题,我找不到.有帮助吗?

android firebase firebase-cloud-messaging

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

Android Studio 2.2.3到2.3更新

我正在尝试将Android Studio 2.2.3更新为最近宣布的Android Studio 2.3.

Help -> Check for update在菜单中尝试过,但它的显示对话框如下:

在此输入图像描述

我目前有Android Studio 2.2.3

编辑:

在此输入图像描述

我该如何更新?我应该下载新的吗?

android android-studio android-studio-2.2 android-studio-2.3

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

在 Android 中使用 Gson 从通知数据中解析嵌套的 JSON 数组

我正在从 FCM 通知中获取 JSON 格式的数据。它具有基于通知类型的不同格式,如下所示:

格式 1:accept_request:

{
   "alert": "Accept Request By driver",
   "title": "Accept Request By driver",
   "booking_id": "247",
   "notification_type": "accept_request"
}
Run Code Online (Sandbox Code Playgroud)

格式 2:end_request:

{
    "alert": "End trip By driver",
    "title": "End trip By driver",
    "booking_id": "247",
    "notification_type": "end_request",
    "servicesList": [
        {
            "service_id": "1",
            "service_name": "Services1",
            "status": "true",
            "sub_category": [
                {
                    "sub_cat_id": "1",
                    "sub_cat_name": "Doctors on call",
                    "service_cost": "15.00",
                    "service_cat_id": "1",
                    "cost": 0
                }
            ],
            "is_multiple_choose": "0",
            "total_cost": 15
        }
}
Run Code Online (Sandbox Code Playgroud)

我已经创建CommonNotificationBean.java为 POJO 类。我已经成功解析了accept_request.

它的工作是因为所有键都有字符串值并且 …

android json gson firebase-notifications

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

尝试在PHP中使用SimplePie库时出现弃用错误

我正在研究新闻应用程序,我需要解析当前的新闻RSS (Really Simple Syndication).

我找到了SimplePie库来RSS轻松解析feed.

首先,我直接在服务器上使用了这个库php code.

<?php
// Make sure SimplePie is included. You may need to change this to match the location of autoloader.php
// For 1.0-1.2:

#require_once('../simplepie.inc');
// For 1.3+:
require_once('./php/autoloader.php');


// We'll process this feed with all of the default options.
$feed = new SimplePie("https://news.google.com/news/feeds?pz=1&cf=all&ned=us&hl=en&topic=h&num=3&output=rss");

// Set which feed to process.

// Run SimplePie.
$feed->init();

// This makes sure that the content is sent to the browser as …
Run Code Online (Sandbox Code Playgroud)

php rss simplepie

-4
推荐指数
1
解决办法
733
查看次数