您好,我有一个简单的问题,我有一个alertDialog,我希望它显示我在这里搜索过的两个按钮,但似乎之前的选项不再工作,已被弃用.
任何人都知道这样做的新方法你可以看到下面的代码不起作用.
Button share = (Button) findViewById(R.id.btn_share);
share.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// call some other methods before that I guess...
AlertDialog alertDialog = new AlertDialog.Builder(PasswActivity.this).create(); //Read Update
alertDialog.setTitle("Uprgade");
alertDialog.setMessage("Upgrade Text Here");
alertDialog.setButton("Upgrade", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
});
alertDialog.setButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
});
alertDialog.show(); //<-- See This!
}
});
Run Code Online (Sandbox Code Playgroud) 我正在使用一个选框来显示我的一个活动中的文本.我的问题是可以加快选框的速度,使其更快地沿着屏幕滚动.下面是我的XML和Java.
TextView et2 = (TextView) findViewById(R.id.noneednum);
et2.setEllipsize(TruncateAt.MARQUEE);
et2.setText("");
if (num.size() > 0) {
for (String str : num) {
et2.append(str + " ");
}
}
et2.setSelected(true);
}
Run Code Online (Sandbox Code Playgroud)
和XML:
<TextView
android:id="@+id/noneednum"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:gravity="center_vertical|center_horizontal"
android:lines="1"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="Large Text"
android:textColor="#fff"
android:textSize="140dp" />
Run Code Online (Sandbox Code Playgroud) 我已经构建了一个自定义的相机应用程序,我正在尝试更改所拍摄图像的重新分配.我已经读过这可能取决于Android的手机或版本?
我知道他们已经设置使用setParameters但只是不知道如何设置真正的resoloution适用于所有手机.我希望它有点小,否则我的app力会关闭.当我在640x348上使用测试图片时,这种尺寸/分辨率将是完美的.
它可能更容易使用setPictureSize?
public void surfaceCreated(SurfaceHolder holder) {
// TODO Auto-generated method stub
camera = Camera.open();
try {
Camera.Parameters parameters = camera.getParameters();
if (this.getResources().getConfiguration().orientation != Configuration.ORIENTATION_LANDSCAPE) {
parameters.set("orientation", "portrait");
camera.setDisplayOrientation(90);
// Uncomment for Android 2.0 and above
parameters.setRotation(90);
} else {
parameters.set("orientation", "landscape");
camera.setDisplayOrientation(0);
// Uncomment for Android 2.0 and above
parameters.setRotation(0);
}
camera.setParameters(parameters);
camera.setPreviewDisplay(holder);
} catch (IOException exception) {
camera.release();
}
camera.startPreview();
}
Run Code Online (Sandbox Code Playgroud) 我ArrayList在我的代码中使用了一个由一个EditText字段填充的代码,但是我想要限制ArrayList它,所以它只能容纳10个值.添加10个值后,如果另一个尝试添加,我只需要它不添加到Array.任何人有任何想法如何做到这一点?
private static ArrayList<String> playerList = new ArrayList<String>();
Run Code Online (Sandbox Code Playgroud) 所以我在excel中有两列,列A包含与列B几乎完全相同的数据.
我需要一种方法来匹配A列和B列,并且需要从B列中删除A列和B列中相同的任何值.
因此,A栏有11,592个产品SKU编号.
B栏有12,555个产品SKU编号.
我需要一种方法来从B列中获取不在 A 列中的SKU产品编号.也许将它们放入C列?
我正在用Magmi导入产品,但我无法看到图像,我已经解决了其他问题,但没有运气.
当我上传时,我没有得到任何图像未找到的错误,它看起来像它显示在后端,因为它说悬停在查看图像,但当我将鼠标悬停在它上面只是消息,就像那里没有图像.
我media/import在Magmi的"Read Local Images From" 中有这个我假设这是public_html/media/import?
我有那里的图像和我的csv列 image-name.jpg
有没有人之前有这个问题,并找到了解决方案?
UPDATE
添加
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
到清单现在一切正常.
好了,所以我有一个程序,我已经开始建立它到底我希望能够拍摄照片,然后把你带到另一个屏幕,可让您能够"使用"或"重考"的图片.
拍摄图像时,需要将其保存到SD卡上的新文件夹中(如果文件夹不在那里则需要创建它).我几周前完成了所有这些工作,但是在我做了一些编辑并关闭了日食后,我似乎无法恢复工作?
对于这个部分是在int imageNum = 0;我添加了imagesFolder.mkdirs();哪个我相信是正确的创建一个新文件夹,但即使这似乎现在没有工作.
现在图像刚刚被拍摄,新文件夹既未创建也未保存图像.
public class AndroidCamera extends Activity implements SurfaceHolder.Callback {
Camera camera;
SurfaceView surfaceView;
SurfaceHolder surfaceHolder;
boolean previewing = false;
LayoutInflater controlInflater = null;
final int RESULT_SAVEIMAGE = 0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
getWindow().setFormat(PixelFormat.UNKNOWN);
surfaceView = (SurfaceView) findViewById(R.id.camerapreview);
surfaceHolder = surfaceView.getHolder();
surfaceHolder.addCallback(this);
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
controlInflater = LayoutInflater.from(getBaseContext());
View viewControl = controlInflater.inflate(R.layout.control, null); …Run Code Online (Sandbox Code Playgroud) 更新可能更改新活动中的位图大小可能会解决问题
String myRef = this.getIntent().getStringExtra("filepath");
File imgFile = new File(myRef);
Log.e("BeatEmUp", myRef);
if(imgFile.exists()){
Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
ImageView myImage = (ImageView) findViewById(R.id.imagepunch);
myImage.setImageBitmap(myBitmap);
}
Run Code Online (Sandbox Code Playgroud)
这样的事可能吗?
Bitmap scaled = Bitmap.createScaledBitmap(bit, 200, 200, true);
或者这可能是下面最好的方式
到目前为止,我有我的应用程序正在拍照,然后使用一个Intent携带图片并显示在一个新的Activity.一旦我完成了这个,我有一些代码,用顶部显示图像onClick.问题是,当拍摄图像时,我认为这是我的应用程序强行关闭.
在我的logcat中java.lang.OutOfMemoryError: bitmap size exceeds VM budget(Heap Size=7431KB, Allocated=2956KB, Bitmap Size=19764KB),我认为这意味着图像太大了.
我已经通过在代码中放置一个较小的图像而不是拍摄的相机图像进行测试,这也使我回到问题,即它是相机图片的大小.
所以我试图实现This From CommonsWare但到目前为止没有运气.仔细查看代码,我认为它会搜索最小的resouloution/size,然后使用这些设置拍摄相机我正确地想到了这一点,如果是这样,我怎样才能将其实现到我的代码中?
public class AndroidCamera extends Activity implements SurfaceHolder.Callback{
Camera camera;
SurfaceView surfaceView;
SurfaceHolder surfaceHolder;
boolean previewing = false;
LayoutInflater controlInflater = null;
final …Run Code Online (Sandbox Code Playgroud) 我正在使用Magento,我在显示总数时出现问题.
目前我有这个:
Subtotal: £10.00
Shipping & Handling: £5.00
Tax (at the moment just using 20% of Subtotal) (20%):£2.00
Grand Total: £17.00
Run Code Online (Sandbox Code Playgroud)
所以看起来应该是这样的:
Subtotal: £10.00
Shipping & Handling: £5.00
Tax (need it to be 20% of subtotal AND 20% of shipping & Handling) (20%):£3.00
Grand Total: £18.00
Run Code Online (Sandbox Code Playgroud)
正如你所看到的那样,税收从2.00英镑变为3.00英镑,因为我需要20%的运费和手续费以及20%的小计费用?
你好我有一个应用程序,从3个不同的单词阵列制作3个轮子我试图使数组中的单词的文字大小更小可以有人指向我正确的方向.
我已经在我的xml中尝试过文本化但是看起来很有效,所以在java中有没有办法解决这个问题?
谢谢.
public class PasswActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.passw_layout);
initWheel(R.id.passw_1, new String[] { "One", "Two", "Three" });
initWheel(R.id.passw_2, new String[] { "Four", "Five", "Six" });
initWheel(R.id.passw_3, new String[] { "Seven", "Eight", "Nine" });
Button mix = (Button) findViewById(R.id.btn_mix);
mix.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mixWheel(R.id.passw_1);
mixWheel(R.id.passw_2);
mixWheel(R.id.passw_3);
}
});
}
private boolean wheelScrolled = false;
OnWheelScrollListener scrolledListener = new OnWheelScrollListener() {
public void onScrollingStarted(WheelView wheel) {
wheelScrolled = true;
} …Run Code Online (Sandbox Code Playgroud) 好的,过去几周我已经发生了几次这样的事情,我无法弄清楚如何修复它.基本上我的应用程序使用相机,但经常在应用程序上的相机几次后,它有时会强制关闭,甚至不能使用其他应用程序或手机上的默认相机.
我发现修复此问题的唯一方法是重启手机.
从我到目前为止所读到的,我知道我需要打电话
camera.release();
camera = null;
但是我有时会得到强制关闭的错误,有人可能只是看看我可能会错过camera.release();某个地方.
public class AndroidCamera extends Activity implements SurfaceHolder.Callback{
Camera camera;
SurfaceView surfaceView;
SurfaceHolder surfaceHolder;
boolean previewing = false;
LayoutInflater controlInflater = null;
final int RESULT_SAVEIMAGE = 0;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
getWindow().setFormat(PixelFormat.UNKNOWN);
surfaceView = (SurfaceView)findViewById(R.id.camerapreview);
surfaceHolder = surfaceView.getHolder();
surfaceHolder.addCallback(this);
surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
controlInflater = LayoutInflater.from(getBaseContext());
View viewControl = controlInflater.inflate(R.layout.control, null);
LayoutParams layoutParamsControl
= new LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT);
this.addContentView(viewControl, layoutParamsControl);
Button …Run Code Online (Sandbox Code Playgroud) UPDATE
如果您尝试在此链接上的表格http://jsfiddle.net/Matt_KP/BwmzQ/小提琴并选择右上方的40英镑单选按钮,然后在底部看到订单总额为40英镑.然后,如果您选择75英镑,订单总额将变为75英镑,但如果您再次返回并再次检查40英镑,则订单总额为75英镑+ 40英镑,而选中的单选按钮应为40英镑.
更新结束
我有一个带有单选按钮的部分,如果选择了其他按钮,则只能检查某些单选按钮.因此,如果用户选择了一个单选按钮但随后选择了另一个,则第一个单选按钮将被取消选中,因为它们不能同时选择这两个单选按钮.
此外,我在单选按钮中使用自定义属性,该属性data-price保存每个需要添加的单选按钮的值.
问题是当用户选择一个单选按钮时,总显示正常,但是如果用户选择了另一个不能选择前一个单选按钮的单选按钮,它会将总数添加到前一个单选按钮上,它应该只添加单选按钮.检查.这有点像缓存我认为的总数.
这就是我使用的总计已检查的单选按钮:
<script type="text/javascript">
jQuery(document).ready(function($){
$('input:radio').change(function(){
var total = 0.0;
$('input:radio:checked').each(function(){
total += parseFloat($(this).data('price'));
});
$('#total').val(total.toFixed(2));
});
})
</script>
Run Code Online (Sandbox Code Playgroud) android ×8
magento ×2
arrays ×1
commonsware ×1
e-commerce ×1
excel ×1
java ×1
javascript ×1
jquery ×1
magmi ×1
radio-button ×1