小编Lis*_*nne的帖子

Android:下载的文件保存在哪里?

我正在努力开发一个"文档管理器"

我有必要访问从互联网,Gmail,其他邮件客户端,其他互联网资源下载的文件......

我想了解这些文件在Android上的存储位置:

1-如果有SD

2-如果没有SD卡

这样我就可以随时在我的应用程序中向用户显示它们.

任何帮助非常感谢.

android download

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

setImeOptions:为什么软键盘上没有显示"完成"按钮?

我尝试使用input.setImeOptions(EditorInfo.IME_ACTION_DONE)在软键盘上设置"完成"按钮;

但"完成"按钮根本不会显示在软键盘上.

有什么建议吗?

public void modif(int position) {
    AlertDialog.Builder alert = new  AlertDialog.Builder(MainActivity.this);
    alert.setTitle("Modifica");
    EditText input = new EditText(MainActivity.this);
    input.setImeOptions(EditorInfo.IME_ACTION_DONE);
    alert.setView(input);
    final Editable value = input.getText();
    alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {  
        public void onClick(DialogInterface dialog, int whichButton) {
            Toast.makeText(getApplicationContext(), value,   Toast.LENGTH_LONG).show();
        }
    });

    alert.setNegativeButton("Cancel", new     DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int whichButton) {
        // Canceled.
        }
    });
    alert.show();                   
}
Run Code Online (Sandbox Code Playgroud)

android ime android-softkeyboard

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

Android:如何记录所有Activity方法调用?

我想有一个快速的方法来记录对活动调用的所有超级方法的所有调用.

我试过这个https://github.com/stephanenicolas/loglifecycle

但由于某种原因它不适用于AppCompatActivity......

我可以要求我的IDE覆盖所有方法; 但是如何将Log添加到所有这些?手动?一定有办法..

android android-lifecycle

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

LinearLayout中的中心按钮

我有这个布局:

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

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@android:color/darker_gray"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/mon"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_weight="10"
        android:text="M\nO\nN" />

    <CheckBox
        android:id="@+id/cbmon"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_weight="10" />

    <TimePicker
        android:id="@+id/timePicker1mon"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_weight="40" />

    <TimePicker
        android:id="@+id/timePicker2mon"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_weight="40" />
</LinearLayout>

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:background="@android:color/white"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/mon"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_weight="10"
        android:text="T\nU\nE" />

    <CheckBox
        android:id="@+id/cbtue"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_weight="10" />

    <TimePicker
        android:id="@+id/timePicker1tue"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_weight="40" />

    <TimePicker
        android:id="@+id/timePicker2tues"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_weight="40" />
</LinearLayout>

<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_weight="1" …
Run Code Online (Sandbox Code Playgroud)

android android-linearlayout

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

Android AlarmManager: is there a way to cancell ALL the alarms set?

I am building an app that set 2 alarms for each day of the week (at a certain hour and minute), the alarms repeat week after week forever.

Now the point is: if the user changes the alarms, I will need cancel the previously set alarms.

Is there a way to simply cancel all the alarms set by my application ?

android alarmmanager

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

禁用工具栏滚动

我有当前的设置:

<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/coordiator_layout_in_main"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <android.support.v7.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:minHeight="?attr/actionBarSize"
        app:layout_scrollFlags="scroll|enterAlways"/>
</android.support.design.widget.AppBarLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior">

    <android.support.design.widget.NavigationView
        android:layout_width="170dp"
        android:layout_height="match_parent"
        android:fitsSystemWindows="true"/>

    <FrameLayout
        // I place a fragment containing a viewpager containing    fragments that contain a recyclerview.... 
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_toRightOf="@+id/nav_view">

    </FrameLayout>
</RelativeLayout>

<FrameLayout
    android:id="@+id/settings_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:visibility="invisible">
</FrameLayout>

<android.support.design.widget.FloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/ic_refresh"
    app:layout_anchor="@id/coordiator_layout_in_main"
    app:layout_anchorGravity="bottom|right|end"   
   app:layout_behavior="com.material.widget.MyFloatingActionButtonBehavior" />

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

现在一切都按预期工作,如果我在包含片段的framelayout内滚动,工具栏可以根据需要滑入和滑出

现在重点是,如果我滚动位于framelayout侧面的NavView(以及relativelayout内部),我想禁用工具栏滑入和滑出

但无论我是否删除所有滚动行为,工具栏都会继续滑入和滑出(只有禁用它的方法是从appbarlayout中移除滚动标记,但禁止所有滑入和滑出tolbar)

请问我在这里错过了什么?是不是应该将滚动事件传递给CoordinatorLayout的scolling行为?

android android-design-library androiddesignsupport android-coordinatorlayout android-appbarlayout

14
推荐指数
3
解决办法
1957
查看次数

Picasso + convertView:我在这里做错了什么?

这是我的getView().

我显然在这里做错了,因为我列表中的第一项始终没有显示图片.

这里的问题是the convertview因为如果我不回收它,没有问题.

请问我做错了什么?

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    if(convertView==null) //IF I DELETE THIS IF EVERYTHING OK!!!
    convertView = inflater.inflate(R.layout.square, null);
    ImageView image = (ImageView) convertView.findViewById(R.id.background_image);
    if (data.get(position).isFollowed()) {
        int approprieteimage = getApproppreiateImage(data.get(position));
        Picasso.with(context).load(approprieteimage).centerCrop().error(R.drawable.no_image_available).transform(new TealTransformation(context)).fit().into(image);
    } else {
        int approprieteimage = getApproppreiateImage(data.get(position));
        Picasso.with(context).load(approprieteimage).centerCrop().error(R.drawable.no_image_available).fit().into(image);

    }
    AbsListView.LayoutParams layoutParams = new AbsListView.LayoutParams(width / 2, width / 2);
    convertView.setLayoutParams(layoutParams);
    return convertView;
}
Run Code Online (Sandbox Code Playgroud)

android convertview picasso

13
推荐指数
2
解决办法
751
查看次数

Android中的Branch.io deeplink甚至无论如何都会打开Play商店

无论如何,当我点击使用branch.io创建的链接时,用户将被带到Google Play: - ((

这是清单中的相关活动:

<activity
        android:name=".activities.DetailActivity"
        android:configChanges="keyboard|screenSize|orientation"
        android:screenOrientation="portrait">
        <intent-filter>
            <data
                android:host="open"
                android:scheme="foo" />
            <action android:name="android.intent.action.VIEW" />

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

这是branch.io仪表板:

在此输入图像描述

android branch.io

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

Android共享元素转换:英雄视图在其他人面前绘制

请查看此视频,其中显示了共享元素活动转换.这是从列表活动到详细活动的过渡.

[视频链接不再有效]

如您所见,imageview被绘制在选项卡前面.

我期望的是在imageview上以字体绘制标签并在整个过渡过程中淡出(这样在动画结束时它们就消失了).

似乎唯一有用的是设置windowSharedElementsUseOverlay为true,但这有其他丑陋的效果,所以这似乎不是一个选项.

最常建议的方法是在转换本身中包含选项卡,但问题是详细信息活动中没有选项卡,因此无法共享它们.


代码:我开始这样的详细活动:

options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, pairs);
ActivityCompat.startActivity(activity, subActivity, options.toBundle());
Run Code Online (Sandbox Code Playgroud)

android shared-element-transition

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

Android Paint:如何获得"喷枪"效果?

我正在关注API演示中的"FingerPaint"演示.

我需要得到一个"喷枪"效果,因为当我画在同一个地方时,它会变得更暗更暗.

请看图片:

因为你可以看到中心更暗,因为我不止一次地在同一个地方涂上了油漆.

请问如何获得相同的效果,如果超过一次吸取变暗点?

在此输入图像描述

编辑编辑

建议

mPaint.setAlpha(0x80) 
Run Code Online (Sandbox Code Playgroud)

有点工作,但只有当我释放触摸然后再次触摸,如果我不释放并将手指放在屏幕上,则无法达到效果.

关键是如果你没有将手指从屏幕上松开,你就无法达到效果,如果你继续绘画而不释放触摸,那么在涂漆时它不会变暗.如果您松开触摸然后再次绘制,则会获得效果

这是我得到的结果.我不想要:

在此输入图像描述

这将是期望的结果:

在此输入图像描述


这是从API演示中获取的代码:

public class FingerPaint extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(new MyView(this));

    mPaint = new Paint();
    mPaint.setAntiAlias(true);
    mPaint.setDither(true);
    mPaint.setColor(0x44FF0000);
    mPaint.setStyle(Paint.Style.STROKE);
    mPaint.setStrokeJoin(Paint.Join.ROUND);
    mPaint.setStrokeCap(Paint.Cap.ROUND);
    mPaint.setStrokeWidth(12);

}

private Paint mPaint;

public class MyView extends View {

    private static final float MINP = 0.25f;
    private static final float MAXP = 0.75f;

    private Bitmap mBitmap;
    private Canvas mCanvas;
    private Path mPath;
    private Paint mBitmapPaint;

    public MyView(Context c) {
        super(c); …
Run Code Online (Sandbox Code Playgroud)

java graphics android paint

12
推荐指数
2
解决办法
4704
查看次数