Defining an XML vertical line drawable

by Caspa » Mon, 19 Apr 2010 04:09:09 GMT


Sponsored Links
 Hello,

I'm trying to figure out how to define a verical line (1px thick) to
be used as a drawable.

to make a horizontal one, it's pretty straightforward:

<shape xmlns:android=" http://schemas.android.com/apk/res/android" ;
android:shape="line">
    <stroke android:width="1dp" android:color="#0000FF"/>
    <size android:height="50dp" />
</shape>

The question is, how to make this line vertical?

Yes, there are workarounds, such as drawing a rectangle shape 1px
thick, but that complicates the drawable xml, if it consists of
multiple <item> elements.

Anyone had any chance with this?

--



Defining an XML vertical line drawable

by patbenatar » Mon, 19 Apr 2010 17:37:55 GMT


 You could use a 1x1 Nine-Patch PNG....






>


Sponsored Links


Defining an XML vertical line drawable

by Caspa » Tue, 20 Apr 2010 23:49:39 GMT


 Thanks for the suggestion patbenatar!

I'm aware I could go for a 1px png drawable or draw the vertical line
as a View etc.

However since there is a "line" shape, I assume there is a way of
drawing it vertically, or at least there SHOULD be.

Can anyone confirm this being possible / not possible?

Kacper




> >



Defining an XML vertical line drawable

by patbenatar » Wed, 21 Apr 2010 03:29:46 GMT


 Yea my idea is largely a hack... Always better to confirm no standard
method exists before pursuing hacks :)







> > >



Other Threads

1. How to call a clicked item within an intent??

Hi,


in my code I am trying to call the last clicked item within an
intent.

Inside an onClick event, the Uri gets tagged to keep track of the item
that was clicked, but I don't know how I can call this uri now from
the intent.

What I mean is: here I tag the item...

 vGrid.setOnItemClickListener(new OnItemClickListener() {

                @Override // click on item and open options menu
                        public void onItemClick(AdapterView<?> parent, View v, 
int
position, long id) {

                        //get uri of selected/clicked video
                         String uri = (String) v.getTag();
                        String [] proj={MediaStore.Video.Media.DATA};
                        videocursor =
managedQuery( MediaStore.Video.Media.EXTERNAL_CONTENT_URI, proj,
null,null,null);
                        videocursor.moveToPosition((int) 
vGrid.getSelectedItemId());

                        // print the filename
                        Toast.makeText(ShareGalleryView.this, "You just 
selected "
+uri, Toast.LENGTH_SHORT).show();

                        openOptionsMenu(); //Opens Options Menu by clicking a 
video
                        }
        });

and inside an menu I would like to call the item that was clicked and
attach it to the new intent: i.putExtra(Intent.EXTRA_STREAM,
Uri.fromFile(new File(""))); //HOW TO CALL THE CLICKED ITEM??

@Override //creates options menu with menu-items
        public boolean onCreateOptionsMenu(Menu menu) {

          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.menu_gallery_share, menu);
          return super.onCreateOptionsMenu(menu);
        }
        @Override //what happens when a menu item is clicked
        public boolean onOptionsItemSelected (MenuItem item){

                 try{
        //Facebook
        if (item.getItemId() == R.id.menu_facebook)
                {
                 //TODO open fb
                new AlertDialog.Builder(this)
                  .setTitle("No Service")
              .setMessage("Sorry, Facebook is not supported yet!")
              .setNeutralButton("Close", new
DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                                // TODO Auto-generated method stub
                    }}).show();
                        return true;

                }
           //YouTube
                else if (item.getItemId() == R.id.menu_youtube)
                {
                        //TODO open YouTube

                        new AlertDialog.Builder(this)
                          .setTitle("No Service")
                      .setMessage("Sorry, YouTube is not supported yet!")
                      .setNeutralButton("Close", new
DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int 
which) {
                                        // TODO Auto-generated method stub
                            }}).show();

                      return  true;
                }
                else if (item.getItemId() == R.id.menu_email)
                {

                        Intent i = new Intent(Intent.ACTION_SEND);
                        i.setType("text/plain");
                        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        i.setType("video/mp4");
                        i.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(new 
File(""))); //HOW
TO CALL THE CLICKED ITEM??
                        startActivity(i);

                        return true;

                }
                else if (item.getItemId() == R.id.menu_bluetooth)
                {
                        // TODO send via bluetooth
                        new AlertDialog.Builder(this)
                          .setTitle("No Service")
                      .setMessage("Sorry, Bluetooth is not supported yet!")
                      .setNeutralButton("Close", new
DialogInterface.OnClickListener() {
                                @Override
                                public void onClick(DialogInterface dialog, int 
which) {
                                        // TODO Auto-generated method stub
                            }}).show();
                        return true;

                }

                    }
                 catch(Exception e)
                    {
                    e.printStackTrace();
                    }
                      return super.onContextItemSelected(item);
        }

Any help is welcome, I would really appreciate if someone could give
me a hand here.

Thank you.

-- 

2. Retreive Default Application associated with a file type



Applications have nothing to do with MIME types in Android.

You can use PackageManager, and methods like queryIntentActivities(),
to determine what will respond to a given Intent, such as one where
you have set the MIME type to be what you want.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.1 Available!

-- 

3. HTC EVO Cyanogenmod Nightly Build [cm_supersonic-07192010-045042] (unstable

4. "Sorry, this video cannot be played" on Nexus one 2.2

5. Android kernel developer advocacy/guidance?

6. How to give a rubber-band/bounce effect to ListView (similar to iPhone)

7. how to make library for another application to use