Tag: android layout

如何在tabView中使用撰写电子邮件活动?

我想在Tab Activity中显示撰写电子邮件。 这是我的代码。 TabHost tabHost=getTabHost(); TabHost.TabSpec spec; Intent intent; //View tabView= tabHost.getChildAt(0); //tabView.setPadding(0, 13, 0, 13); //tabView.setBackgroundColor(0xFFFFFFFF); intent=new Intent(“com.android.phone.action.RECENT_CALLS”).setClass(this,CallListActivity.class); spec=tabHost.newTabSpec(“Call”).setIndicator(“Call”).setContent(intent); tabHost.addTab(spec); intent=new Intent(“android.intent.action.Compose_EMAIL”); intent.setClassName(“com.android.email”, “com.android.email.activity.MessageCompose”); spec=tabHost.newTabSpec(“Message”).setIndicator(“Message”).setContent(intent); tabHost.addTab(spec); intent=new Intent().setClass(this, com.android.contacts.qs.logger.email.QsEmailLogger.class); spec=tabHost.newTabSpec(“Email”).setIndicator(“Email”).setContent(intent); tabHost.addTab(spec); intent=new Intent().setClass(this,com.android.contacts.qs.logger.notification.NotificationLogger.class); spec=tabHost.newTabSpec(“Notification”).setIndicator(“Notification”).setContent(intent); tabHost.addTab(spec); tabHost.setCurrentTab(0); 此代码生成错误。 错误是03-16 12:04:09.132:E / AndroidRuntime(312):java.lang.SecurityException:从com.android.email(使用uid 10011)请求代码在进程android.process.acore中运行(使用uid 10001) intent=new Intent(“android.intent.action.Compose_EMAIL”); intent.setClassName(“com.android.email”, “com.android.email.activity.MessageCompose”); spec=tabHost.newTabSpec(“Message”).setIndicator(“Message”).setContent(intent); tabHost.addTab(sp

E / RecyclerView:没有连接适配器; 跳过布局不显示recyclerview中的数据

任何人都可以在这里帮助解决方案我得到的错误 E / RecyclerView:没有连接适配器; 跳过布局 这是我的文件。 OneFragment.java public class OneFragment extends Fragment implements SearchView.OnQueryTextListener { private static final String TAG = “RecyclerViewExample”; private List feedsList; private RecyclerView mRecyclerView; private MyRecyclerViewAdapter adapter; private ProgressBar progressBar; private SearchView mSearchView; public OneFragment() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override […]

找不到类’android.graphics.drawable.RippleDrawable’,无法执行android的方法:onClick,Android Studio

我正在尝试制作一个用于订购咖啡的应用程序。 (我真的很陌生。) 我的应用程序运行正常,直到出现两个错误。 现在,它在设备中运行,但是当您尝试触摸按钮时,它会停止。 代码是: package com.example.android.justjava; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.TextView; import java.text.NumberFormat; /** * This app displays an order form to order coffee. */ public class MainActivity extends AppCompatActivity { int quantity = 0; //int priceOfOneCup = 5; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } /** * This […]

不从服务器读取文本

我试图从服务器读取所有文本,我认为我的代码不是从服务器检索文本,请你帮我解决这个问题,我是android开发的新手。 提前致谢 public class TestActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); TextView tv= (TextView)findViewById(R.id.my_text); try { URL url = new URL(“http://www.google.com:80/”); StringBuilder content = new StringBuilder(); // read text returned by server BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); String line; while […]

Android:滚动视图中不可见的按钮

我正在制作一个Android应用程序来输入用户信息,因为我有两个按钮和数字选择器,我的按钮是自定义的,并没有在Android工作室的预览中显示也没有在模拟器中 这是我的代码

如何知道RecyclerView是否有足够的内容滚动?

目前我正在使用带有LinearLayout Manager的RecyclerView和作为HeaderView的EditText来过滤列表的内容。 如果RecyclerView的内容小于RecyclerView本身,我想隐藏EditText。 如果其内容可以滚动,有没有办法“询问”Recyclerview或LayoutManager? 谢谢你们。

无法在后台的while循环中发布异步任务的进度 – Android

我想从doInBackground更新对话框的下载进度。 我正在打印日志以及发布进度。 他们都没有工作。 它最后更新对话框,最后一次打印所有日志值 private class DownloadEReport extends AsyncTask { int progress = 0; protected void onPreExecute() { mProgressDialog = new ProgressDialog(EReport.this); mProgressDialog.setTitle(“Downloads”); mProgressDialog.setMessage(“Downloading, Please Wait!”); mProgressDialog.setIndeterminate(false); mProgressDialog.setMax(100); mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); mProgressDialog.setCancelable(false); mProgressDialog.show(); } @Override protected void onProgressUpdate(Void… values) { super.onProgressUpdate(values); mProgressDialog.setProgress(progress); } @Override protected Void doInBackground(String… strings) { String mUrl = strings[0]; String json = “”; […]

如何解析JSON字符串Android

我正在尝试解析下面的JSONString [[{“0″:” “,”title”:” Technical Support Analyst in Noida”,”1″:” “,”Company Name”:” Oracle”,”2″:” “,”Category”:”Fresher”,”3″:” “,”Job Type”:”Full Time”,”4″:” “,”Location”:”Noida”,”5″:” “,”Job Qualification”:”BE\/BTch\/Bsc\/Others”,”6″:” “,”Job Experience”:”Freshers”,”7″:” “,”Job postdate”:”2013-6-05″,”8″:” “}]] 我的代码: // try parse the string to a JSON object try { //jObj = new JSONObject(JsonString); JSONArray ja = new JSONArray(result); int size = ja.length(); Log.d(“tag”, “No of Elements ” + ja.length()); […]

适用于listview的自定义布局的适配器

我正在开发一个android项目,我必须从String数组(比如title,description,id)加载到listview项TextView。 我使用像这样的游标对数据库进行了类似的操作 String[] from = new String[]{“medicine”,”healthsystem”}; int[] to = new int[] {R.id.textlist1,R.id.textlist2}; // Now creating an array adapter and set it to display using my row SimpleCursorAdapter notes =new SimpleCursorAdapter(this,R.layout.notes_row, c, from, to); 我列出了“from”中的所有目标以及“to”中的所有目标。 现在我的问题是我没有数据库所以不能使用游标。 我有3个字符串数组,我想加载到每个项目的textviews(标题,描述,id) 怎么做请帮助我谢谢你:)

Android java.lang.ClassCastException:android.widget.RelativeLayout无法强制转换为android.widget.EditText

我在Android中遇到以下exception,点击按钮将我从一个活动带到另一个活动(我是Android开发中的新手,所以它可能不是最明亮的问题): java.lang.ClassCastException:android.widget.RelativeLayout无法强制转换为android.widget.EditText 我已经尝试过几次清理项目了,我已经尝试过Android Tools中的Fix Project Properties选项,我已经检查了我的xml是否有错误,但我似乎无法弄清楚这一点。 我必须提一下,该按钮运行良好一段时间,直到发生此exception。 这是我的xml: 这是抛出exception的活动中的onCreate方法: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_customer_info); this.editMail = (EditText)findViewById(R.id.editCustomerEmail); this.editName = (EditText)findViewById(R.id.editCustomerName); this.editPhone = (EditText)findViewById(R.id.editCustomerPhone); // the exception points me here }