我有一个显示图像数组的图库,点击它们时会显示在图像视图中.我希望能够分享当前在意图选择器中显示的图像.我无法弄清楚如何选择当前图像.
图库代码:
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView = new ImageView(mContext);
imageView.setImageResource(mImageIds[position]);
imageView.setLayoutParams(new Gallery.LayoutParams(150, 120));
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setBackgroundResource(mGalleryItemBackground);
return imageView;
}
Run Code Online (Sandbox Code Playgroud)
意图选择代码:
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/png");
share.putExtra(Intent.EXTRA_STREAM,
Uri.parse("android.resource://com.appinfluence.fanapp.v1/drawable/" + Integer.toString(R.drawable.alright)));
startActivity(Intent.createChooser(share, "Share Image"));
Run Code Online (Sandbox Code Playgroud)
在哪里说R.drawable.alright我需要它以某种方式成为当前图像的变量.有任何想法吗?
当我点击播放按钮播放歌曲并将歌曲mp3与它捆绑在一起并在onStartCommand中接收时,我开始服务.问题是当我启动服务的活动结束时,我的服务再次调用onStartCommand.当它接收该捆绑时它不存在,因为这次活动没有启动它.因此,我在准备媒体播放器时遇到了非法的例外情况.我没有约束我的服务.
为什么在我的活动结束时会调用onStartCommand?
启动服务:
Intent i = new Intent(SongList.this,MyService.class);
i.putExtra("songURL", user.songurlz);
i.putExtra("songNAME", songplay_name);
startService(i);
Run Code Online (Sandbox Code Playgroud)
服务类:
public class MyService extends Service {
static MediaPlayer mediaPlayer;
static int pauseplay;
static NotificationManager notificationManagerPlay;
static CharSequence tickerText;
static Notification notification4;//Notification variable(for song playing)
TelephonyManager telephonyManager;
PhoneStateListener listener;
static Notification notification;
static NotificationManager mNotificationManager;
String songurl;
String songname;
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate() {
super.onCreate();
mediaPlayer = new MediaPlayer();
pauseplay = 1;
MainMenu.serviceRunning …Run Code Online (Sandbox Code Playgroud) 我正在开发一个应用程序,它使用包装在 AppBarLayout 中的工具栏,它允许用户通过应用主题样式来更改应用程序的主题。由于某种原因,当主题具有深色工具栏时,阴影会消失(或变得不那么明显?)。
这是我的 XML 工具栏:
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:background="?attr/colorPrimary"
app:itemIconTint="@android:color/black"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:titleTextAppearance="?attr/actionBarTheme"
android:theme="@style/ThemeOverlay.AppCompat.ActionBar" >
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="?attr/actionBarTheme"
android:layout_gravity="center" />
</android.support.v7.widget.Toolbar>
</android.support.design.widget.AppBarLayout>
Run Code Online (Sandbox Code Playgroud)
我正在使用 ?attr/colorPrimary 设置工具栏的背景颜色。
带有白色工具栏的主题(阴影存在且非常明显):
<style name="WhiteBlack" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@android:color/white</item>
<item name="colorPrimaryDark">@android:color/white</item>
<item name="colorAccent">@android:color/black</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay</item>
<item name="actionBarTheme">@style/ToolbarTitleDark</item>
<item name="actionBarStyle">@style/ToolbarTitleDark</item>
</style>
<style name="ToolbarTitleDark" parent="@style/TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textSize">20sp</item>
<item name="android:textColor">@android:color/black</item>
<item name="colorControlNormal">@android:color/black</item>
</style>
Run Code Online (Sandbox Code Playgroud)
工具栏较暗的主题(阴影丢失或几乎不可见):
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item …Run Code Online (Sandbox Code Playgroud) 我正在使用宏来阻止我的SAS程序出错,但它总是断开与服务器的连接,然后我再也无法取回我的临时数据集了.
我试过了:
OPTIONS ERRORABEND;
Run Code Online (Sandbox Code Playgroud)
这是我尝试过的宏:
%macro errchk;
%if &syserr >0 and &syserr ne 4 %then %abort;
%mend errchk;
Run Code Online (Sandbox Code Playgroud)
这个在达到错误后继续处理以下数据步骤.
我无法弄清楚如何阻止程序的其余部分运行,但不能断开与SAS服务器的连接.有任何想法吗?
这是一个选择语句,用于计算我数据库中歌曲的平均评分
SELECT *, (tab.rating_sum/tab.rating_count) as rating_average FROM
(SELECT song_id, COUNT(rating) rating_count, SUM(rating) rating_sum FROM ratings
GROUP BY song_id) tab
INNER JOIN SONGS WHERE SONGS.id = tab.song_id
Run Code Online (Sandbox Code Playgroud)
当在 RATINGS 中插入新评级时,我需要将表 RATINGS 中的列 rating_average 插入到表 SONGS 中。我还需要确保它进入正确的 Song_id 列。我怎样才能用触发器做到这一点?我一直在扯头发。
这是我能想到的最好的方法,但我不知道我在用触发器做什么:
CREATE TRIGGER rating_trig ON ratings FOR INSERT AS
BEGIN
UPDATE SONGS SET
rating = SELECT (tab.rating_sum/tab.rating_count) as rating_average FROM
(SELECT song_id, COUNT(rating) rating_count, SUM(rating) rating_sum FROM ratings
GROUP BY song_id) tab
INNER JOIN SONGS WHERE SONGS.id = tab.song_id
END
Run Code Online (Sandbox Code Playgroud)
表格布局:
评分 | …
我正在尝试修改 TradingView 上的 pine 脚本指标,以便它在主图表上指标标题旁边显示指标/图的值。但是,我不想实际绘制任何内容,因为它会扰乱图表的比例。我也不希望它显示在图表上方或下方的单独窗口中。这可以用 Pine 脚本实现吗?
我尝试将 display=display.none 传递给“plot”函数,但这同时删除了值标签和线条。这是代码(图像示例没有“显示”参数):
//@version=4
study(title="ADR %", overlay=true)
length = input(20, title="length")
dhigh = security(syminfo.tickerid, 'D', high)
dlow = security(syminfo.tickerid, 'D', low)
adr = 100 * (sma(dhigh/dlow, length) - 1)
plot(adr, title="ADR %", display=display.none)
Run Code Online (Sandbox Code Playgroud) 在我的Flash Player中,查看用户是否在Android电子市场中拥有特定应用的最简单方法是什么?如果他们没有它,我希望能够在继续使用该应用程序之前将它们带到市场下载.谢谢.