我想知道为什么典型的" hamburger"图标不显示在我ActionBar的左侧,而是我看到s后箭头符号.在我的代码中,我在ActionBarDrawerToggle对象中使用汉堡包图标,但它不会在应用程序中显示.
我究竟做错了什么?
package com.example.pymdev.pym_app;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.app.Activity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import com.facebook.login.LoginManager;
/**
* Fragment used for managing interactions for and presentation of a navigation drawer.
* See the <a href="https://developer.android.com/design/patterns/navigation-drawer.html#Interaction">
* design guidelines</a> for a …Run Code Online (Sandbox Code Playgroud) 我正在使用下面的代码,并且它在下面运行良好android 5。我可以从 SD 卡中选择图像或视频。
Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
photoPickerIntent.setType("video/* image/*");
getActivity().startActivityForResult(photoPickerIntent, 1);
Run Code Online (Sandbox Code Playgroud)
然而Android L它只显示视频。尝试搜索但没有找到任何内容,任何帮助将不胜感激。
我用这个例子来获取图像路径.当我获得小图像路径时,每件事情都可以,但是当我想要获得巨大的图像路径时,我的应用程序就会粉碎.我不知道为什么会发生这种情况,因为我不使用ImageView来显示所选路径中的图像.
我的代码在这里打开图库并选择图片:
selectImgBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, 0);
//urlTV.setText(getMainPath());
}
});
Run Code Online (Sandbox Code Playgroud)
第二个显示路径:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == Activity.RESULT_OK && data != null){
String realPath;
if (Build.VERSION.SDK_INT < 19){
realPath = RealPathUtil.getRealPathFromURI_API11to18(this, data.getData());
} else {
realPath = RealPathUtil.getRealPathFromURI_API19(this, data.getData());
}
setMainPath(realPath);
/*setFile(realPath);
setToTextViews(Build.VERSION.SDK_INT, data.getData().getPath(), realPath);*/
urlTV.setText(getMainPath());
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢!
引起:java.lang.IllegalArgumentException:不是文档:content:// media/external/images/media/32257,位于com.example.murager.httpclientapp的android.provider.DocumentsContract.getDocumentId(DocumentsContract.java:629). classes.RealPathUtil.getRealPathFromURI_API19(RealPathUtil.java:19)com.example.murager.httpclientapp.activities.MainActivity.onActivityResult(MainActivity.java:98)at android.app.Activity.dispatchActivityResult(Activity.java:5456)at android Android.app.ActivityThread上android.app.ActivityThread.access $ 1300(ActivityThread.java:151)的android.app.ActivityThread.handleSendResult(ActivityThread.java:3596)上的.app.ActivityThread.deliverResults(ActivityThread.java:3549) $ H.handleMessage(ActivityThread.java:1369)位于android.app.AtoT.Thread.main上的android.os.Handler.dispatchMessage(Handler.java:110)android.os.Looper.loop(Looper.java:193)处.(ActivityThread.java) …
我想使用颜色代码将状态栏颜色更改为特定颜色。如下所示,只能在代码中指定默认颜色,有没有办法指定特定的颜色代码来获得该颜色?
<item name="android:statusBarColor">@color/dark_blue_Shade1</item>
Run Code Online (Sandbox Code Playgroud) 假设我有这样的 Json 响应:
{
"status": true,
"data": {
"29": "Hardik sheth",
"30": "Kavit Gosvami"
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用 Retrofit 解析 Json 响应。根据这个答案,我将不得不使用Map<String, String>它来提供地图中的所有数据。现在我想要的是ArrayList<PojoObject>.
PojoObject.class
public class PojoObject {
private String mapKey, mapValue;
public String getMapKey() {
return mapKey;
}
public void setMapKey(String mapKey) {
this.mapKey = mapKey;
}
public String getMapValue() {
return mapValue;
}
public void setMapValue(String mapValue) {
this.mapValue = mapValue;
}
}
Run Code Online (Sandbox Code Playgroud)
将 a 转换Map<key,value>为 a的最佳方法是List<PojoObject>什么?