小编San*_*osh的帖子

ListView下方的LinearLayour不可见

为什么只有ListView可见?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<ListView android:id="@+id/android:list" android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:layout_gravity="center" android:choiceMode="singleChoice">
</ListView> 


<LinearLayout android:orientation="horizontal"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
      android:gravity="center"
    android:layout_marginTop="15dp"> 

    <Button android:id="@+id/viewComplaintsMoreButton"
        android:text="  More  "  
        android:layout_width="wrap_content" android:layout_height="wrap_content" />

    <Button android:id="@+id/viewComplaintsCancelButton"
        android:text="  Cancel  "  
        android:layout_marginLeft="50dp" android:layout_width="wrap_content"
        android:layout_height="wrap_content" />

</LinearLayout>

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

android listview

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

如何从android中的库中打开一个特定的文件夹?

我正在使用以下代码打开Android默认图库应用程序.它会打开sdcard下的所有图像文件夹.我怎样才能打开一个特定的文件夹?

    Intent intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
    intent.setType("image/*");
    startActivityForResult(Intent.createChooser(intent, "Pick any photo"), SELECT_IMAGE_FROM_GALLERY_CONSTANT);
Run Code Online (Sandbox Code Playgroud)

android android-intent android-gallery

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

图像覆盖与相机捕获图像在android中

我需要用相机拍照,同时在相机视图顶部显示叠加图像.拍摄照片后,我需要保存用户在拍照时看到的内容.谁能建议我?请.

overlay image android-camera

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

如何在android中读取Nfc标签?

如何从NFC标签中读取和显示NDEF消息?请帮我.任何人都可以提供示例源代码来读取Nfc标签吗?

android nfc

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

通过Intent发送电子邮件:SecurityException

以下是我通过Gmail应用发送电子邮件的方式.

        Intent emailIntent = new Intent(Intent.ACTION_SEND);
        emailIntent.setClassName("com.google.android.gm", "com.google.android.gm.ComposeActivityGmail");
        emailIntent.setType("text/html");
        emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Puzzle");
        emailIntent.putExtra(Intent.EXTRA_TEXT, someTextHere));
        emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(attachmentFile));
         try {
            startActivityForResult(emailIntent, SHARE_PUZZLE_REQUEST_CODE);
        } catch (ActivityNotFoundException e) {
            showToast("No application found on this device to perform share action");
        } catch (Exception e) {
            showToast(e.getMessage());
            e.printStackTrace();
        }
Run Code Online (Sandbox Code Playgroud)

它没有启动Gmail应用程序,但显示以下消息.

java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.SEND typ=text/html cmp=com.google.android.gm/.ComposeActivityGmail (has extras) } from ProcessRecord{8293c64 26854:com.xxx.puzzleapp/u0a383} (pid=26854, uid=10383) not exported from uid 10083
Run Code Online (Sandbox Code Playgroud)

关于SOF的问题很少,建议大多数使用exported = true.但我无法使用此解决方案,因为我正在启动另一个应用程序的活动.你能指导我吗?

android-intent android-securityexception android-6.0-marshmallow

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

如何在java中的静态方法中使用此关键字?

有没有办法this在Java中的静态方法中使用关键字?我想在我的activity类中的静态方法中显示Toast消息.我怎么做?谢谢.

java static android this

3
推荐指数
2
解决办法
7391
查看次数

无法从Android中的图库中选择少量照片

我从我的应用程序调用默认图库应用程序来选择任何照片.下面是我从库中获取所选图像路径的代码.它对所有照片都很好,除了很少.当我从图库中选择任何PICASA上传的照片时,应用就会强行关闭.请帮我.


在onActivityResult()....

            Uri selectedImage = data.getData();
            String[] filePathColumn = { MediaStore.Images.Media.DATA };
            Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null);
            cursor.moveToFirst();
            int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
            String selectedPhotoPath = cursor.getString(columnIndex).trim();  <<--- NullPointerException here
            cursor.close(); 
            bitmap = BitmapFactory.decodeFile(selectedPhotoPath);
            ......      
Run Code Online (Sandbox Code Playgroud)

android uri gallery cursor

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

在ViewPager中滑动最后一页后指示

我创建了一个带有圆形页面指示器的视图寻呼机.它的工作正常.这是我的新要求:当我在上一页/第一页并尝试滑动下一页/上一页时,我的屏幕应向滑动方向移动至少30%并返回其原始位置,因为没有更多页面导航?当然,我在顶部有页面指示器,告诉我在可用页面中的位置.我希望我的要求是明确的.我怎样才能实现它?请帮我.提前致谢.

android android-viewpager viewpagerindicator

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

如何在android中更改sherlock actionbar overflow-dropdown项目的文本颜色?

以下是我如何更改sherlock actionbar overflow-dropdown菜单的背景颜色.如何更改下拉项目文本颜色和重力?请帮我.目前文字颜色为黑色.在此输入图像描述

<style name="AppBaseTheme" parent="@style/Theme.Sherlock.Light.ForceOverflow">

</style>
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">  
    <item name="android:actionOverflowButtonStyle">@style/CustomActionOverFlowStyle</item>
    <item name="actionOverflowButtonStyle">@style/CustomActionOverFlowStyle</item>
    <item name="actionButtonStyle">@style/CustomActionButtonStyle</item>
    <item name="android:actionButtonStyle">@style/CustomActionButtonStyle</item>
     <item name="android:dropDownListViewStyle">@style/CustomDropDownListView</item>
    <item name="dropDownListViewStyle">@style/CustomDropDownListView</item>

</style>

<style name="CustomDropDownListView" parent="android:style/Widget.Holo.ListView.DropDown">
    <item name="android:background">@color/abs__bright_foreground_disabled_holo_dark</item> <!-- this works -->
    <item name="android:textColor">@color/white</item> <!-- but this is not working -->
    <item name="android:divider">@color/app_bg_color</item>
    <item name="android:dividerHeight">0.5dp</item>
    <item name="android:dividerPadding">1dp</item>
    <item name="android:gravity">right</item>
</style>
Run Code Online (Sandbox Code Playgroud)

android actionbarsherlock drop-down-menu android-styles

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

如何在android中删除自定义列表视图项?

我的布局文件中有一个列表视图和一个按钮.我点击该按钮将项目添加到listview.活动开始时列表视图应为空,但应通过向其添加项目来增加.这是我在onCreate()中的代码:

list  = (ListView)findViewById(R.id.inverterListView);
adapter = new ArrayAdapter<String>(InverterList.this, R.layout.inverters_list_row, R.id.inverterNumberTextViewInPanelListRow);
 list.setAdapter(adapter); 
Run Code Online (Sandbox Code Playgroud)

在这里我将项目添加到listview onclick的按钮.

adapter.add(inverterNo);
adapter.notifyDataSetChanged();
Run Code Online (Sandbox Code Playgroud)

这很好用.任何人都可以指导我删除自定义列表视图项目?提前致谢.

android android-arrayadapter android-listview

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