小编Vir*_*tel的帖子

在Android Pie(API-28)中输入活动时键盘不显示

我想在进入电子邮件登录界面时弹出设备键盘.

我宣布windowSoftInputMode"stateVisible"AndroidManifest.xml中的文件:

<activity
        android:name=".activities.EmailLoginActivity"
        android:launchMode="singleTask"
        android:screenOrientation="portrait"   
        android:windowSoftInputMode="stateVisible" />
Run Code Online (Sandbox Code Playgroud)

我已经按照这个文档.

结果:

在运行最多27个Android API的设备上,会显示键盘.

在运行Android API 28的设备上,未显示键盘.

这是Android Pie中的错误吗?

有什么建议吗?

android android-softkeyboard android-studio android-9.0-pie

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

自动完成时发生自动完成错误:OVER_QUERY_LIMIT

当我尝试在“地点自动完成”中搜索时,出现“无法加载搜索结果” 并且日志显示

“自动填充时出错:OVER_QUERY_LIMIT”

我已启用https://console.cloud.google.com/, 并且API密钥运行良好。

在此处输入图片说明

Java代码

    String apiKey = "MY API KEY";
    private RadioGroup mRadioGroup;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_costumer_map);
        // Obtain the SupportMapFragment and get notified when the map is ready to be used.
        mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);

        Places.initialize(getApplicationContext(), apiKey);

        PlacesClient placesClient = Places.createClient(this);
          // Initialize the AutocompleteSupportFragment.
        AutocompleteSupportFragment autocompleteFragment = (AutocompleteSupportFragment)
                getSupportFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);

        // Specify the types of place data to return.
        autocompleteFragment.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME));

        // Set up a PlaceSelectionListener to handle the response. …
Run Code Online (Sandbox Code Playgroud)

android google-maps google-places-api google-places

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

Room 数据库:什么是索引特定列(索引和@Index)以及如何使用它?

我指的是 Room 数据库的索引特定列。

下面是一些示例代码写在这里https://developer.android.com/training/data-storage/room/defining-data#column-indexing

示例代码-1:

    @Entity(indices = {@Index("name"),
        @Index(value = {"last_name", "address"})})
public class User {
    @PrimaryKey
    public int id;

    public String firstName;
    public String address;

    @ColumnInfo(name = "last_name")
    public String lastName;

    @Ignore
    Bitmap picture;
}
Run Code Online (Sandbox Code Playgroud)

示例代码 2:

@Entity(indices = {@Index(value = {"first_name", "last_name"},
        unique = true)})
public class User {
    @PrimaryKey
    public int id;

    @ColumnInfo(name = "first_name")
    public String firstName;

    @ColumnInfo(name = "last_name")
    public String lastName;

    @Ignore
    Bitmap picture;
}
Run Code Online (Sandbox Code Playgroud)

这在 android 的房间文档中有所描述,我使用了索引来表示列的唯一性,但是上面的代码意味着什么,谁能解释一下?

Q1:索引和@Index有什么用?
Q2:是什么区别@Index("name")@Index(value …

android android-room android-architecture-components

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