我正在尝试在我的测试应用程序中创建菜单选项.
当我将清单中的主题设置为默认时,我能够看到菜单(菜单显示在顶部).如果我将清单中的主题设置为NoTitleBar.我看不到菜单选项?
我想在清单中设置主题"NoTitleBar"时获取菜单.
怎么解决?
以下是我在测试应用程序中使用的内容:
与清单:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<activity
android:name="com.ssn.menuoptions.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
和
menu.xml文件
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/menu_preferences"
android:title="Preferences" />
</menu>
Run Code Online (Sandbox Code Playgroud)
Java文件:
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
Run Code Online (Sandbox Code Playgroud)
有可能得到这样的东西:

如何让菜单显示下来?
谢谢!
我有一个奇怪的问题.我正在尝试将Facebook集成到我的应用程序中.功能部分工作正常,但问题是它只能直接从我的电脑连接,即如果连接我的手机eclipse和发送应用程序它是正常工作.如果我提取apk并直接从我的手机安装它该应用程序不会登录我,不会创建会话等.
有人能告诉我这里有什么问题吗?
更新1:
通过以下官方Facebook开发者网站创建SK9推荐的密钥.
C:\ Java\jdk1.7.0_10\bin> keytool -exportcert -alias myAppfull -key store myAppfull | C:\ openssl-0.9.8k_X64\bin\openssl sha1 -binary | C:\ openssl-0.9.8k_X64\bin\openssl base64我收到密码提示.我在eclipse中输入用于导出的密码,它给出了一个代码.我进入了开发者页面.
其中:myAppfull是我在使用eclipse导出时使用的别名和密钥库.
还是同样的问题?有什么我想念的吗?
谢谢!
更新2:
有效!谢谢!!可能对其他人有用.检查我的答案如下!
我使用内置的Drupal 7用户模块,用户注册,忘记密码 - 电子邮件和所有这些东西.
我忘记了我的管理员密码.我可以访问我的网站,该网站托管在1and1.com上,并且还可以访问mysql?
是否可以通过SQL更改密码或电子邮件地址,以便我可以访问管理页面?
如果有可能如何?你能帮助我吗?
谢谢!
是否可以在不打开应用程序的情况下发送whatsApp消息,在后台发送,如使用以下方式发送短信:
smsManager.sendTextMessage("+12546304580", null, "Test Message", null, null);
Run Code Online (Sandbox Code Playgroud)
如果是这样的话?我尝试的代码打开了APP(WITH INTENT):
Intent waIntent = new Intent(Intent.ACTION_SEND);
waIntent.setType("text/plain");
String text = "Test Message";
waIntent.setPackage("com.whatsapp");
waIntent.putExtra(Intent.EXTRA_TEXT, text);//
startActivity(Intent.createChooser(waIntent, "Share with"));
Run Code Online (Sandbox Code Playgroud)
或者是否可以打开应用程序发送消息到给定地址并关闭它?
谢谢!
我在栏上有菜单项的操作栏.当我点击刷新图标时,我有显示进度条的方法.
我想加载这个活动.因此,我尝试以编程方式单击调用刷新图标项:
onOptionsItemSelected(menu.findItem(R.id.action_Refresh));
Run Code Online (Sandbox Code Playgroud)
我在创建菜单后调用上面的内容.
但这会在加载我的数据时给出空指针异常.如果我点击刷新按钮它工作正常,但如果我以编程方式调用它我会收到错误.
这是我有的:
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
this.optionsMenu = menu;
getMenuInflater().inflate(R.menu.main, menu);
onOptionsItemSelected(menu.findItem(R.id.action_Refresh));
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item)
{
switch (item.getItemId())
{
case R.id.action_about:
aboutapp();
return true;
case R.id.action_Refresh:
Log.e("REfressh","Clicked");
Mapsthree.refreshValue = 0;
timer = new Timer();
timerMethod();
setRefreshActionButtonState(true);
displayView(1);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
private void timerMethod()
{
timer.scheduleAtFixedRate(new TimerTask()
{
@Override
public void run()
{
updateProgressBar();
}
}, 0, 800);
}
private void updateProgressBar()
{
runOnUiThread(new Runnable()
{ …Run Code Online (Sandbox Code Playgroud) android selection android-actionbar actionmode android-actionmode
我正在尝试简单的程序,如果移动有声音.所以在开始的时候我已经失声了 - 播放声音1然后每次移动它都会继续播放声音.在第4阶段,我从头开始玩.
问题在于:当我不移动我的手指并将其保持在同一位置时,声音仍然保持1比1 - 计算出x和y值的触发.我怎么阻止这个?
OnTouchListener MyOnTouchListener= new OnTouchListener()
{
public boolean onTouch(View view, MotionEvent event)
{
switch(event.getAction() & MotionEvent.ACTION_MASK)
{
case MotionEvent.ACTION_DOWN:
x = (int) event.getX();
y = (int) event.getY();
oldval = x+y;
break;
case MotionEvent.ACTION_MOVE:
{
Log.e("X value", "X is "+x);
Log.e("Y value", "Y is "+y);
try
{
Thread.sleep(500);
} catch (InterruptedException e) {
}
int newval= (int) (event.getX() + event.getY());
if(Math.abs(oldval-newval)>50)
{
Log.e("First", "next button");
longpressCount++;
if(longpressCount==1)
{
Log.e("1", "BUTTON PRESSED");
}
else if(longpressCount==2)
{
Log.e("2", …Run Code Online (Sandbox Code Playgroud) 我正在尝试一个显示所有手机等的简单联系人应用程序.当我点击联系人姓名时,它会在对话活动中显示联系人号码.当我的数字较少时,我可以正确地看到名称和数字..但如果我有更多的数字,活动中的名称部分会被切断..请检查下面的屏幕截图.
你能看到Joe David的文字和个人资料图片被剪掉了.数字在listview中正确显示,因此我可以向下或向上滚动查看所有数字.
如何解决这个问题? - 这个屏幕截图来自Nexus 5,但在Nexus 4/Galaxy nexus也一样..我已经尝试过这些..不确定在其他手机..
XML详细信息:
<?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="match_parent"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/LayoutContactNumber"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".20"
android:background="@drawable/blackbg"
android:gravity="left|center"
android:orientation="horizontal" >
<com.res.dese.number.ResizableImageView
android:id="@+id/CImage"
android:layout_width="120px"
android:layout_height="120px"
android:padding="5dp"
android:scaleType="fitXY"
android:src="@drawable/no_pic" />
<TextView
android:id="@+id/PhoneLabel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:freezesText="true"
android:gravity="center|left"
android:marqueeRepeatLimit="marquee_forever"
android:paddingLeft="5dp"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="XXX"
android:textColor="#2CABE2"
android:textSize="30sp"
android:textStyle="bold" />
</LinearLayout>
<ImageView
android:id="@+id/whiteline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/whiteline" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".65"
android:orientation="vertical" >
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="#007FFF"
android:dividerHeight="3dp" >
</ListView>
</LinearLayout>
<ImageView
android:id="@+id/whiteline"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center" …Run Code Online (Sandbox Code Playgroud) 我试图给我的行动栏透明效果.我使用了以下一行来使它以这种方式工作,但奇怪的是在我的Nexus 5上我可以看到酒吧即将到来,但在我的银河系nexus我根本看不到它.
我不知道为什么N5会出现这种情况?如何解决这个问题?
这是代码:
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setDisplayShowHomeEnabled(false);
ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
actionBar.setStackedBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
setContentView(R.layout.profile);
Run Code Online (Sandbox Code Playgroud)
以下是运行Jelly Bean(4.3)的Galaxy nexus和运行kitkat(4.4.4)的Nexus 5的屏幕截图
Galaxy Nexus:完美呈现透明动作条:

Nexus 5:显示透明操作栏:(显示水平线)

更新2:
我设法通过使用以下样式删除N5上的行
styles.xml in Values-v14 folder
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar"></style>
<style name="CustomActionBarTheme" parent="@android:style/Theme.Holo"></style>
then added theme to specific activity in manifext:
<activity
android:name=".Profile"
android:label="@string/profile"
android:theme="@style/CustomActionBarTheme"
android:screenOrientation="portrait" >
Run Code Online (Sandbox Code Playgroud)
但是在此活动中我的所有文本,对话框格式都已更改.它变得黑暗.即使我以编程方式更改对话框的主题,它也不会更改.我不确定是什么问题?有人可以帮我解决这个问题吗?
更新1:根据@erakitn建议:我尝试了以下几个更改:
<!-- Transparent ActionBar Style -->
<style name="CustomThemeTransparent" parent="AppBaseTheme">
<item name="android:background">@android:color/transparent</item>
<item name="background">@android:color/transparent</item>
</style>
<!-- Activity Theme with transparent ActionBar -->
<style name="CustomThemeTransparentLight" parent="AppBaseTheme"> …Run Code Online (Sandbox Code Playgroud) 我正在尝试一个基于自定义的列表视图,它有一个文本和复选框。我想禁用复选框的可点击功能。这样用户将只能单击项目行而不是单击复选框。
我尝试了以下方法:
holder.checkbox = (CheckBox) convertView.findViewById(R.id.checkBox);
holder.checkbox.setClickable(false);
Run Code Online (Sandbox Code Playgroud)
这不是禁用可点击的。我该如何解决这个问题?
谢谢!
我试图在Async中的OnPostExecture中发布一个Toast.
这是我所做的,但它没有记录,也没有烘烤.
protected class sendDetails extends AsyncTask<Context, Integer, Boolean>
{
@Override
protected Boolean doInBackground(Context... params)
{
try
{
Thread.sleep(1000);
}
catch (InterruptedException e)
{
}
sendEmail();
return true;
}
@Override
protected void onPostExecute(Boolean result)
{
runOnUiThread(new Runnable()
{
public void run()
{
Toast.makeText(mContext, "Email Succesfully Sent...", Toast.LENGTH_SHORT).show();
}
});
}
@Override
protected void onPreExecute()
{
super.onPreExecute();
finish();
}
}
Run Code Online (Sandbox Code Playgroud)
我也尝试过以下方法:
声明上下文:
private Context mContext;
Run Code Online (Sandbox Code Playgroud)
//调用异步
new sendDetails(mContext).execute();
Run Code Online (Sandbox Code Playgroud)
//异步代码:
protected class sendDetails extends AsyncTask<Context, Integer, Boolean>
{
public sendDetails(final Context context) …Run Code Online (Sandbox Code Playgroud) android ×9
actionmode ×1
android-xml ×1
drupal ×1
drupal-7 ×1
facebook ×1
menuitem ×1
motionevent ×1
selection ×1
whatsapp ×1