小编Nee*_*ava的帖子

如何为Listview项目分隔线指定填充

在此输入图像描述

如何在图像中显示列表项目时如何填充.我想在布局中制作分隔线,如图所示.

这是我的列表片段代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" 
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="25dp"
android:layout_marginRight="25dp">

 <ListView 
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
     android:id="@+id/listV_main"
    android:layout_marginLeft="25dp"
android:layout_marginRight="25dp"/>
Run Code Online (Sandbox Code Playgroud)

这是我的List部分代码

<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingTop="10dp"
android:paddingRight="10dp"
android:paddingBottom="10dp">
<include
    android:id="@+id/list_item_section_text"
    layout="@android:layout/preference_category"
     />
Run Code Online (Sandbox Code Playgroud)

这是我的清单项目代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:minHeight="?android:attr/listPreferredItemHeight"
android:adjustViewBounds="true"
android:paddingRight="?android:attr/scrollbarSize"
   >
<ImageView
    android:id="@+id/showlist_item_entry_drawable"
    android:layout_width="82dp"
    android:adjustViewBounds="true"
    android:layout_height="68dp"
    android:scaleType="fitXY"
    android:paddingLeft="9dp"/> 
<RelativeLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="10dip"
    android:layout_marginRight="6dip"
    android:layout_marginTop="6dip"
    android:layout_marginBottom="6dip"
    android:layout_weight="1"
>
    <TextView android:id="@+id/list_item_entry_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:singleLine="true"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:ellipsize="marquee"
        android:fadingEdge="horizontal" /> 
    <TextView android:id="@+id/list_item_entry_summary"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/list_item_entry_title"
        android:layout_alignLeft="@id/list_item_entry_title"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:singleLine="true"
        android:textColor="?android:attr/textColorSecondary" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

android android-layout

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

标签栏和导航抽屉对齐

我正在尝试制作一个应用程序,其中标签栏,导航抽屉和搜索所有都在工具栏下,但当我尝试在tabbar页面标题分开时 这是即将到来的 我想在哪里显示其他片段的标题也是布局代码

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Boss.Main2Activity">

<android.support.design.widget.CoordinatorLayout

    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/bg_img"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scaleType="fitXY" />


    <com.antonyt.infiniteviewpager.InfiniteViewPager
        android:id="@+id/pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <me.alexrs.fontpagertitlestrip.lib.FontPagerTitleStrip
            android:id="@+id/titlestrip"
            android:layout_width="wrap_content"
            android:layout_height="50dp"
            android:layout_marginEnd="50dp"
            android:layout_marginStart="50dp"
            android:background="@color/material_fragment_top"

            app:fontFamily="@font/font"

            app:theme="@style/AppTheme.PopupOverlay" />

    </com.antonyt.infiniteviewpager.InfiniteViewPager>


<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="50dp"

    app:theme="@style/CustomActionBar" />

<include layout="@layout/content_main2" />
</android.support.design.widget.CoordinatorLayout>
<android.support.design.widget.NavigationView
    android:id="@+id/nav_view"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_main"
    app:menu="@menu/activity_main_drawer" />

</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)

我希望布局在导航抽屉和搜索之间显示导航抽屉和标签栏以及搜索栏图标和页面标题,因为您可以看到它分离得太多.我试图使工具栏像黑色播放器应用程序

android tabbar android-layout android-toolbar

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

如何从MediaStore.File和MediaStore.File.FileColumn获取数据

我试图让所有文件名都包含音频文件我已经使用Mediastore来获取媒体商店音频,专辑,播放列表和音频数据,但我如何获得包含音频文件的文件或文件夹标题.这是我尝试过的代码,但它不正确,因为我无法设置External_Content_uri.这是我试过的代码.

  private void External() {
    try {
        String[] proj = {MediaStore.Files.FileColumns.TITLE,
                MediaStore.Files.FileColumns._ID,
                MediaStore.Files.FileColumns.PARENT,
                MediaStore.Files.FileColumns.DATA
        };// Can include more data for more details and check it.

        String selection =MediaStore.Files.FileColumns.MEDIA_TYPE+"=?";

        String[] selectionArgs = {"MediaStore.Files.FileColumns.MEDIA_TYPE_AUDIO"};

        String sortOrder = MediaStore.Audio.Media.TITLE + " ASC";

        Cursor audioCursor = getContentResolver().query(MediaStore.Files.getContentUri("\"external\""), proj, selection, selectionArgs, sortOrder);

        if (audioCursor != null) {
            if (audioCursor.moveToFirst()) {
                do {
                    int filetitle = audioCursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.TITLE);
                    int file_id = audioCursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns._ID);
                    int fileparent = audioCursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.PARENT);
                    int filedata = audioCursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DATA);
                    Mediafileinfo info = new Mediafileinfo(); …
Run Code Online (Sandbox Code Playgroud)

android mediastore android-file android-mediaplayer

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

无法从中加载模块元数据

我现在被困了一天试图解决这个问题我刚刚更新了我的 android studio 但是当我打开旧项目时它显示错误

Could not resolve all dependencies for configuration 
':app:debugAndroidTestRuntimeClasspath'.
Could not load module metadata from C:\Users\NEELAY\.gradle\caches\modules- 
2\metadata-2.36\descriptors\com.android.support\multidex- 
instrumentation\1.0.2\5ac5911800d0dfe0ba2d29f224b8c2fb\descriptor.bin
Unexpected metadata type found.
Run Code Online (Sandbox Code Playgroud)

我也遵循了一些问题,其中说要卸载 android 支持存储库并重新安装,但它不起作用尝试 gradle.setting 也是正确的。现在我不知道如何解决这个问题,任何帮助都会有所帮助。显现

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fireapp.manoj.template">
<uses-permission android:name="android.permission.INTERNET" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

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

这是清单代码,但不知道为什么它显示为 setting.gradle 不知道为什么是因为 gradle 更新

android compiler-errors android-studio

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

运行时异常无法启动活动

我在Android中制作了一个应用程序并且它工作正常但是当我将我的应用程序移动到我的主应用程序时,它开始显示错误,从那一点包名称与我之前的应用程序相同然后这也是我得到的错误.I跟着很多问题,但无法找到任何解决方案.

 FATAL EXCEPTION: main
                                              Process: unnion.neelay.beatbox, PID: 12739
                                              java.lang.RuntimeException: Unable to start activity ComponentInfo{unnion.neelay.beatbox/unnion.neelay.beatbox.ringdroid.RingdroidSelectActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2423)
                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483)
                                                                       at android.app.ActivityThread.access$900(ActivityThread.java:153)
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                       at android.os.Looper.loop(Looper.java:148)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5441)
                                                                       at java.lang.reflect.Method.invoke(Native Method)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
                                                                    Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean java.lang.String.equals(java.lang.Object)' on a null object reference
                                                                       at unnion.neelay.beatbox.ringdroid.RingdroidSelectActivity.onCreate(RingdroidSelectActivity.java:123)
                                                                       at android.app.Activity.performCreate(Activity.java:6303)
                                                                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
                                                                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2376)
                                                                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2483) 
                                                                       at android.app.ActivityThread.access$900(ActivityThread.java:153) 
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349) 
                                                                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                       at …
Run Code Online (Sandbox Code Playgroud)

android android-library

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

如何更改主要颜色,颜色primarydark等

我试图让应用赋予选项来改变基色,色彩原色暗的应用程式.因此,用户可以根据选择更改颜色.我想在设置中给出这个选项.所以用户可以选择黑色,深蓝色,蓝色等.我知道如何在xml中设置应用程序的主题,但我想更改孔应用程序的颜色.我想改变所有的活动和对话的主题应用.作为一个不能作为改变应用的主题,在这里它被提及.这就是为什么我想在可能的情况下制作不同的颜色文件

  1. 我是否必须为不同的语言制作不同的颜色文件?

  2. 如果是的话,我怎么能使用不同的颜色文件呢?

android themes colors android-layout

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