小编Joh*_*Joe的帖子

更改自动增量起始编号?

在MySQL中,我有一个表,我想将auto_increment值设置为5而不是 1.这是可能的,这是什么查询语句?

mysql

254
推荐指数
5
解决办法
29万
查看次数

无论位图的大小如何,我如何使ImageView成为固定大小

所以我正在从Web服务加载图像,但是图像的大小有时比其他图像更小或更大,当我将它们放入android中的ListView时,可视化看起来很傻.我想修改我的ImageView的大小,以便它只显示图像的一部分,如果它大于预设量.我已经尝试了所有我能想到的设置setMaxWidth/setMaxHeight,将scale类型设置为centerCrop,使用ClipableDrawable包装我的BitmapDrawable,使用Drawable.setBounds()进行设置.我已经尝试过设置XML并以编程方式设置,但都没有工作.我很惊讶设置最大宽度/高度没有做任何事情.下面是我在布局文件中使用ImageView定义的XML:

    <ImageView android:id="@+id/recipeImage"
           android:maxHeight="64px"
           android:maxWidth="64px"
           android:scaleType="centerCrop"
           android:layout_width="wrap_content"
           android:layout_height="fill_parent"
           android:layout_alignParentTop="true"
           android:layout_alignParentBottom="true"
           android:layout_marginRight="6dip"/>
Run Code Online (Sandbox Code Playgroud)

但是,没有任何效果.

java android bitmap imageview

36
推荐指数
1
解决办法
4万
查看次数

改造将多个图像上传到单个密钥

我正在使用Retrofit将图像上传到我的服务器.在这里,我需要为单个密钥上传多个图像.我已经尝试使用Postman Web客户端,它运行良好.这是一个截图.在此输入图像描述

以下是请求的键值对.
SurveyImage:[file1,file2,file3];
PropertyImage:文件
DRA:jsonBody

我试图用Retrofit做同样的事情.但图像没有上传到服务器.这是我的代码.
WebServicesAPI.java

public interface WebServicesAPI {
    @Multipart
    @POST(WebServices.UPLOAD_SURVEY)
    Call<UploadSurveyResponseModel> uploadSurvey(@Part MultipartBody.Part surveyImage, @Part MultipartBody.Part propertyImage, @Part("DRA") RequestBody dra);
}
Run Code Online (Sandbox Code Playgroud)

这是上传文件的方法.

 private void requestUploadSurvey() {
        File propertyImageFile = new File(surveyModel.getPropertyImagePath());
        RequestBody propertyImage = RequestBody.create(MediaType.parse("image/*"), propertyImageFile);
        MultipartBody.Part propertyImagePart = MultipartBody.Part.createFormData("PropertyImage", propertyImageFile.getName(), propertyImage);
        JSONObject requestBody = getRequestBody();
        RequestBody draBody = null;
        try {
            draBody = RequestBody.create(MediaType.parse("text/plain"), requestBody.toString(1));
            Log.d(TAG, "requestUploadSurvey: RequestBody : " + requestBody.toString(1));
        } catch (JSONException e) {
            e.printStackTrace();
        }
        MultipartBody.Builder builder = new MultipartBody.Builder();
        builder.setType(MultipartBody.FORM); …
Run Code Online (Sandbox Code Playgroud)

android multipartform-data okhttp retrofit2

23
推荐指数
3
解决办法
3万
查看次数

值总是返回0,它应返回插入的行数

我有两张桌子,一张是Information另一张桌子WorkForce

信息

在此输入图像描述

劳动力

在此输入图像描述

该TWF column劳动力来获得id信息,其假设回报1,但它的返回值0.如果id信息是 5,twf应该是5了.

首先我使用它a来表示所选行的数量,然后将参数添加aaddWorkForce.在toast始终显示0.

  a=addInformation(name,weather,date2,status,first1[1],last1[1]);
  Toast.makeText(getApplicationContext(),a+"",Toast.LENGTH_LONG).show();
  addWorkForce(Sub, NoP, NoH,a);
Run Code Online (Sandbox Code Playgroud)

addInformation函数

  public long addInformation( final String name, final String weather, final String date2, final String status, final String timeIn, final String timeOut)
    {
        class AddInfo extends AsyncTask<String, Void, String> {
            ProgressDialog loading;

            @Override
            protected void onPreExecute() {
                super.onPreExecute();
                loading = ProgressDialog.show(WorkDetailsTable.this, "Please Wait",null, true, true); …
Run Code Online (Sandbox Code Playgroud)

php mysql android return toast

20
推荐指数
1
解决办法
608
查看次数

Eclipse只能打开一个JFrame吗?

当第二次运行项目时,可以在之前JFrame关闭之前打开新的项目吗?

所以我不需要JFrame在第二次尝试运行项目时关闭它.

在此输入图像描述

是否可以只打开一个JFrame?

java eclipse jframe

11
推荐指数
1
解决办法
286
查看次数

如何在Tab中增加JTextField的宽度?

Food Tab中,我想实现这一目标

在此输入图像描述

但我只能得到这个

在此输入图像描述

如何增加JTextFieldFood Tab中的宽度?以下是我的代码

 public class FoodOrdering {
        static private JFrame frame;
        static private JTextField textField;
        static private GridBagConstraints gbc;
        static private JLabel[] foodLabel;
        static private JLabel[] labels;
        static private JTextField[] qtyField;
        static private JLabel[] foodImage;
        static private File[] file;
        private static final int ELEMENTS = 9;
        /**
         * Launch the application.
         */
        public static void main(String[] args) {
            EventQueue.invokeLater(new Runnable() {
                public void run() {
                    try {
                        FoodOrdering window = new FoodOrdering();
                        window.frame.setVisible(true);
                    } …
Run Code Online (Sandbox Code Playgroud)

java grid swing jtextfield

9
推荐指数
1
解决办法
334
查看次数

在3个选项卡上添加图像

如何将图像添加到选项卡?目前,我能够标签移至底部,但对如何改变不知道 LL Tab1,LL Tab2,LL Tab3以icon.Am我在正确的道路上?任何帮助将不胜感激.

xml代码

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical"
        android:padding="5dp" >


        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:padding="5dp"
            android:layout_weight="1" >

            <LinearLayout
                android:id="@+id/ll_tab1"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical" />

            <LinearLayout
                android:id="@+id/ll_tab2"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical" />

            <LinearLayout
                android:id="@+id/ll_tab3"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical" />
        </FrameLayout>
        <TabWidget
            android:id="@android:id/tabs"
            android:background="@color/light_gray"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"/>
    </LinearLayout>

</TabHost>
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

有人可以帮忙吗?非常感谢 !

tabs android android-tablayout

8
推荐指数
2
解决办法
1万
查看次数

如何删除文本字段的标签?

想问一下是否可以去掉Flutter中文本字段左上角的标签“Label”。

在此输入图像描述

dart flutter

8
推荐指数
2
解决办法
9243
查看次数

EditText afterTextChanged不起作用

我使用下面的代码插入Uri图像SQLite:

寄存器

private void insertData( String name,String pass, Uri image) throws SQLiteException {
        database = mdb.getWritableDatabase();
        ContentValues cv = new ContentValues();
        cv.put(MyDatabaseHelper.KEY_NAME,    name);
        cv.put(MyDatabaseHelper.KEY_PASSWORD, pass);
        try {
            database = mdb.getWritableDatabase();
            InputStream iStream = getContentResolver().openInputStream(image);
            byte[] inputData = Utils.getBytes(iStream);
            cv.put(MyDatabaseHelper.KEY_IMAGE,inputData);
        }catch(IOException ioe)
        {
            Log.e(TAG, "<saveImageInDB> Error : " + ioe.getLocalizedMessage());
        }
        database.insert(MyDatabaseHelper.TABLE_USER, null, cv);
        Toast.makeText(getApplicationContext(),"Database Created",Toast.LENGTH_SHORT).show();
        database.close();
    }
Run Code Online (Sandbox Code Playgroud)

在我得到的时候Database Created,我假设数据库已成功创建并插入了数据.

Login中,我想要SQLite根据用户名检索图像.

name = (EditText) findViewById(R.id.name);

name.addTextChangedListener(new TextWatcher() {
    @Override
    public void …
Run Code Online (Sandbox Code Playgroud)

sqlite android uri imageview android-edittext

7
推荐指数
1
解决办法
1861
查看次数

Flutter pub 出现错误( open_file_safe ^3.2.3 和 file_picker ^5.2.2 )如何解决此问题?

运行 pub get 后,我​​收到以下错误(第一次构建)

Because file_picker >=5.0.0 depends on ffi ^2.0.1 and open_file_safe 3.2.3 depends on ffi ^1.0.0, file_picker >=5.0.0 is incompatible with open_file_safe 3.2.3.
And because no versions of open_file_safe match >3.2.3 <4.0.0, file_picker >=5.0.0 is incompatible with open_file_safe ^3.2.3.
So, because app depends on both open_file_safe ^3.2.3 and file_picker ^5.2.2, version solving failed.
pub get failed (1; So, because app depends on both open_file_safe ^3.2.3 and file_picker ^5.2.2, version solving failed.)
Run Code Online (Sandbox Code Playgroud)

我尝试运行pub get命令并希望它能够成功运行而不会出现任何错误。

filepicker flutter

7
推荐指数
1
解决办法
1692
查看次数