小编Goo*_*gle的帖子

Android - 无法创建简单的矩形形状... UnsupportedOperationException?

我在使用XML创建一个简单的圆角矩形时遇到了麻烦.每当我尝试将"角落"元素添加到自定义形状时,我得到:

在android.view.View.View.draw(View.java)的android.graphics.drawable.RedientDrawable.draw(GradientDrawable.java:314)上的android.graphics.Path.addRoundRect(Path.java:514)的java.lang.UnsupportedOperationException 6520)...

RES/dawable/rounded_rectangle.xml:

 <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
        <solid android:color="#ffffff"/>    

        <stroke android:width="3dp"
                android:color="#ff000000"/>

        <padding android:left="1dp"
                 android:top="1dp"
                 android:right="1dp"
                 android:bottom="1dp"/> 

        <corners android:bottomRightRadius="7dp" android:bottomLeftRadius="7dp" 
         android:topLeftRadius="7dp" android:topRightRadius="7dp"/> 
    </shape>
Run Code Online (Sandbox Code Playgroud)

使用上面的形状的简单layout.xml:

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

<View android:id="@+id/View01" 
    android:background="@drawable/rounded_rectangle" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent">
</View>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

Fyi,我正在尝试为Android 2.1编译,我已经安装了Eclipse和Android SDK的所有最新更新.这个形状是我在另一个网站上看到的东西的直接副本,但由于某种原因它不想为我工作.

谢谢.

java android

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

如何在Flutter中在图像上显示文本?

我想在中的图像上显示文本Listview。我能够看到图像和文本,但文本将显示在左上角。我想在每个图像的每个文本上显示它。下面是我的代码。请帮我

import 'dart:async';
import 'dart:convert';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:http/http.dart' as http;

Future<List<Photo>> fetchPhotos(http.Client client) async {
  final response = await client.get('url here');
  return compute(parsePhotos, response.body);
}

// A function that will convert a response body into a List<Photo>
List<Photo> parsePhotos(String responseBody) {
  final parsed = json.decode(responseBody);
  return (parsed["data"]["categoryList"] as List)
      .map<Photo>((json) => new Photo.fromJson(json))
      .toList();
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    SystemChrome.setEnabledSystemUIOverlays([]);
    return new MyHomePage();
  }
} …
Run Code Online (Sandbox Code Playgroud)

android flutter

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

flutter 在本地保存文件,以便可通过文件应用程序使用

flutter 有没有办法将文件本地保存在 iPhone 上,以便这些文件可以在文件应用程序中使用?

file flutter

6
推荐指数
1
解决办法
5037
查看次数

如何在android中检查asynctask中的互联网连接

@Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.videoview);


        mVideoView = (VideoView) findViewById(R.id.videoView1);
        scanCode = getIntent().getExtras().getString("ScanCode");


         new GetVideoUrlAsyn().execute();               


        mVideoView.setOnCompletionListener(new OnCompletionListener() {

            @Override
            public void onCompletion(MediaPlayer mp) {
                // TODO Auto-generated method stub

                startActivity(new Intent(getBaseContext(),
                        PostVideoMenuActivity.class));              
            }
        });
    }   
    private class GetVideoUrlAsyn extends AsyncTask<Void, Void,Void> {

        @Override
        protected Void doInBackground(Void... params) {
            // TODO Auto-generated method stub          

            String URL = "http://www.storybehindthestore.com/sbtsws/service/saveinfo.asmx/StoryScanHistorySave";

            WebServiceCall webservice = new WebServiceCall();

            nameValuePairs = new ArrayList<NameValuePair>(4);               

            nameValuePairs.add(new BasicNameValuePair("iSiteID","1"));          
            nameValuePairs.add(new BasicNameValuePair("sVideoURL",scanCode));
            Log.e("scancode",""+ scanCode); …
Run Code Online (Sandbox Code Playgroud)

android android-asynctask

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

当从复选框中取消选中时,如何从数组中删除元素?

当我在itemonsetchenge listner中取消选中复选框时,我想删除所有元素.这是我的代码

  checkbox_timeslot.clear();

          chk.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                // TODO Auto-generated method stub

                String chetimeslot;

                if(isChecked){          

                chetimeslot = (String)chk.getTag();
                checkbox_timeslot.add(chetimeslot);             
                Log.e("array value", ""+checkbox_timeslot);             
                Log.e("checked slo value", ""+chetimeslot);

                }else{          

                checkbox_timeslot.add("");
                Log.e("else array value", ""+checkbox_timeslot);    

            }        
        }

        }); 
Run Code Online (Sandbox Code Playgroud)

"checkbox_timeslot"是我的字符串数组list.i想要删除复选框中的元素是未选中的,并且从复选框列表中选中时添加项目.如何可能有帮助?

android arraylist

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

如何在x轴的左侧放置空格并显示条形图?

private void openChart(){

    double[] data = {0.2, 1.11, 100 };


    // Creating an  XYSeries for Income
    XYSeries expenseSeries = new XYSeries("");
    // Adding data to Income and Expense Series
    for(int i=0;i<data.length;i++){
        expenseSeries.add(i,data[i]);
    }

    // Creating a dataset to hold each series
    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();

    // Adding Expense Series to dataset
    dataset.addSeries(expenseSeries);  

    // Creating XYSeriesRenderer to customize expenseSeries
    XYSeriesRenderer expenseRenderer = new XYSeriesRenderer();
    expenseRenderer.setColor(Color.RED);
    expenseRenderer.setFillPoints(false);
    expenseRenderer.setLineWidth(2);


    // Creating a XYMultipleSeriesRenderer to customize the whole chart
    XYMultipleSeriesRenderer multiRenderer = new …
Run Code Online (Sandbox Code Playgroud)

android bar-chart

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

如何在android中设置(888)777-7777格式的电话号码?

我想用这个(888)777-7777格式的电话号码.我的数字格式为"888-777-7777".我把我的代码放在editTextChangedListener中.如何显示所需的格式?

edt_clientphone.addTextChangedListener(new TextWatcher() {              
        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            // TODO Auto-generated method stub      

             boolean flag = true;
             String eachBlock[] = edt_clientphone.getText().toString().split("-");
             for (int i = 0; i < eachBlock.length; i++) 
             {
                 if (eachBlock[i].length() > 3)
                 {
                     Log.v("data","cc"+flag + eachBlock[i].length());
                 }
             }
             if(flag){
                 edt_clientphone.setOnKeyListener(new OnKeyListener() {

                     @Override
                    public boolean onKey(View v, int keyCode, KeyEvent event) {
                        // TODO Auto-generated method stub
                        if (keyCode == KeyEvent.KEYCODE_DEL)
                             keyDel = 1;
                        return false;
                    }
                 });

                 if …
Run Code Online (Sandbox Code Playgroud)

android

0
推荐指数
1
解决办法
1867
查看次数

java.lang.IndexOutOfBoundsException:索引8无效,大小为8

for(int j=0; j<ServiceProviderCal.ap_title_arr.size();j++)
{           
    if(ServiceProviderCal.ap_title_arr.get(position).isEmpty())
    {
         Holder.relative.setBackgroundColor(android.graphics.Color.rgb(255, 255,255));
    }
    else
    {
        Holder.txtNote1.setText(notes.get(position)+"  For:");
        Holder.txtNote2.setText(des.get(position));
        Holder.relative.setBackgroundColor(android.graphics.Color.rgb(255, 255,0));                 
        //Log.e("Notes...", ""+notes);  
    }
}
Run Code Online (Sandbox Code Playgroud)

android

-3
推荐指数
1
解决办法
3849
查看次数

标签 统计

android ×7

flutter ×2

android-asynctask ×1

arraylist ×1

bar-chart ×1

file ×1

java ×1