小编Asa*_*ssi的帖子

android studio"使用gradle包装器"变灰了

我尝试将eclipse项目导入Android studio.在迁移说明中,它显示"在下面的对话框中,选中Use gradle wrapper并单击OK.(您不需要指定Gradle home.)"

问题是"使用gradle包装器"未被选中并变灰.

有什么建议?

android android-studio

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

是否可以检查通知是否可见或已取消?

我想更新通知数据,但我发现的唯一方法是启动一个具有相同Id的新数据.

问题是如果原件被取消,我不想再提出新的.有没有办法判断通知是否可见或取消?或者只有在通知存在时更新通知的方法?

notifications android

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

在AndroidStudio中禁用c ++调试器

由于AndroidStudio更新2.2,我的本机代码应用程序启动需要很长时间(我看到一个空白屏幕约20秒).

我的猜测是,这是因为c ++调试器需要很长时间才能解决.

可以禁用它(并且只使用好的旧java调试器)吗?

android-ndk android-debug android-studio android-studio-2.2

20
推荐指数
2
解决办法
4333
查看次数

如何在EditText中将光标定位在右侧

我的应用程序使用RTL语言(从右到左).

EditText字段获得焦点时,光标出现在左侧,仅当用户开始键入时,光标(和RTL文本)向右移动.当用户单击"输入"以开始新行时,光标再次向左移动.

当我使用时android:gravity="right",光标是OK(在右侧)但是当用户开始键入时,文本总是移动到另一侧(RTL文本向左移动).

任何想法如何我可以将文本对齐并保持文本方向?

android android-layout right-to-left android-edittext

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

将ViewPager作为ListView中的行放置

我尝试使用ViewPager作为ListView中的行,但是得到一个奇怪的行为 - 只有第一行有效,但是当我滚动列表时它会消失.当我滚动一个空行时,突然看到上面的行.似乎Android创建了一个单一的寻呼机并将其用于所有行.

这是我在启动应用程序时看到的内容:

屏幕截图

这是我的行布局:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@android:color/white"
    android:orientation="vertical"
    android:paddingBottom="2dp" >

    <TextView
        android:id="@+id/textViewFriendName"
        style="@style/TextStyle"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/myFriendsBg"
        android:paddingBottom="5dp"
        android:paddingTop="5dp"
        android:text="TextView" />

    <View style="@style/DividerHorizontalStyle_gray" />

        <android.support.v4.view.ViewPager
            android:id="@+id/pagerMyFriendHabits"
            android:layout_width="match_parent"
            android:layout_height="@dimen/DefaultImageHeight" />


    <View style="@style/DividerHorizontalStyle" />

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

这是我的List适配器:

public class MyFriendsAdapter extends BaseAdapter implements OnClickListener {

    private ArrayList<UiD_UserFriend> mItems;
    private Context mContext;
    private FragmentManager mFragmentManager;

    public MyFriendsAdapter(Context context, ArrayList<UiD_UserFriend> items, FragmentManager fragmentManager) {
        mContext = context;
        mItems = items;
        mFragmentManager = fragmentManager;
    }

    @Override
    public int getCount() {
        return …
Run Code Online (Sandbox Code Playgroud)

android listview android-widget android-layout android-fragments

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

如何判断我使用的是哪个Android支持库v4修订版?

我可以在Android SDK管理器中看到我的计算机上安装的版本(在Android SDK管理器中),但通常一个项目使用libs文件夹中自己的副本.

有没有办法告诉除了文件日期之外在特定项目中使用的android-support-v4.jar版本是什么?

任何方法都很可观 - 通过code/eclipse /文件管理器

android android-version android-support-library

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

HttpGet会自动处理cookie吗?

我想在使用HttpGet连接到服务器时保留会话,我需要了解它如何处理cookie.

服务器开发人员说他自己处理所有cookie.我使用HttpGet请求访问服务器如下:InputStream isResponse = null;

    HttpGet httpget = new HttpGet(strUrl);
    HttpResponse response = mClient.execute(httpget);

    HttpEntity entity = response.getEntity();
    isResponse = entity.getContent();
    responseBody = convertStreamToString(isResponse);

    return responseBody;
Run Code Online (Sandbox Code Playgroud)
  1. 我应该做点什么吗?他是否自动将cookie放在我的设备上,并且HttpGet方法知道使用它以便使用cookie保持sessionID?

  2. 如何检查我的设备上是否存在cookie,以便知道会话是否"活着"?

  3. 如果我使用以下代码来获取cookie:

    CookieStore cookieStore = new BasicCookieStore();
    
    // Create local HTTP context
    HttpContext localContext = new BasicHttpContext();
    // Bind custom cookie store to the local context
    localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore);
    
    HttpGet httpget = new HttpGet(strUrl);
    HttpResponse response = mClient.execute(httpget,localContext);
    
    Run Code Online (Sandbox Code Playgroud)

HttpGet是否仍像以前一样处理cookie?

  1. 我看到DefaultHttpClient(上面代码中的mClient)有自己的CookieStore.如何保存Cookie并在下次创建时加载它们?

java cookies android http httpclient

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

是否可以更改RatingBar方向?

有没有人知道是否有可能让RatingBar从右到左而不是从左到右,或者知道怎么做?

android android-layout

9
推荐指数
3
解决办法
1655
查看次数

android:windowSoftInputMode ="stateVisible"不起作用

我想在Activity开始时打开软键盘,我发现了

android:windowSoftInputMode="stateVisible" 
Run Code Online (Sandbox Code Playgroud)

不起作用.

为了确保,我创建了一个新项目(默认的"Hello world")并执行了以下操作:

  1. 将windowSoftInputMode添加到清单中.
  2. 在那之后不起作用,我在布局中添加了一个EditView字段
  3. 在那之后没有用,我补充道

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) 到onCreate程序.

我用Android2.3.3编译它并尝试在我的Galaxy S2设备和Android4模拟器上运行它仍然 - 没有键盘.

我的清单文件:

<?xml version="1.0" encoding="utf-8"?>
Run Code Online (Sandbox Code Playgroud)

<uses-sdk android:minSdkVersion="9" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name">
    <activity
        android:name=".HelloworldActivity"
        android:label="@string/app_name"
        android:windowSoftInputMode="stateVisible">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

我的main.xml布局:

<?xml version="1.0" encoding="utf-8"?>
Run Code Online (Sandbox Code Playgroud)

<TextView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="@string/hello" />

<EditText
    android:id="@+id/editText1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" >

    <requestFocus />

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

我的代码:

public class HelloworldActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); …
Run Code Online (Sandbox Code Playgroud)

android android-emulator android-layout

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

访问iPhone视频输出图像缓冲区时FPS低

我正在尝试在iPhone上进行一些图像处理.我正在使用http://developer.apple.com/library/ios/#qa/qa2010/qa1702.html来捕捉相机帧.

我的问题是,当我试图访问捕获的缓冲区时,相机FPS从30下降到大约20.有人知道我该如何解决它?

我使用kCVPixelFormatType_32BGRA格式中我能找到的最低捕获质量(AVCaptureSessionPresetLow = 192x144).如果有人知道我可以使用的质量较低,我愿意尝试一下.

当我在其他平台上进行相同的图像访问时,比如Symbian,它可以正常工作.

这是我的代码:

#pragma mark -
#pragma mark AVCaptureSession delegate
- (void)captureOutput:(AVCaptureOutput *)captureOutput 
didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer 
    fromConnection:(AVCaptureConnection *)connection 
{ 
 /*We create an autorelease pool because as we are not in the main_queue our code is
  not executed in the main thread. So we have to create an autorelease pool for the thread we are in*/
 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    CVImageBufferRef imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
 //Lock the image buffer
    if (CVPixelBufferLockBaseAddress(imageBuffer, 0) == kCVReturnSuccess)
    { …
Run Code Online (Sandbox Code Playgroud)

iphone image-processing video-processing avfoundation

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