How can I specify a border color for an ImageView when it has focus

by Roy » Tue, 04 Aug 2009 23:15:00 GMT


Sponsored Links
 You can create a xml file under res/drawable. For example: res/
drawable/text_style.xml

Here is the content:
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android=" http://schemas.android.com/apk/res/android" ;>
        <item android:state_pressed="true" android:drawable="@drawable/
shape_2" />
        <item android:state_focused="true" android:state_enabled="true"
android:drawable="@drawable/shape_5" />
</selector>

Here is shape_2.xml
<shape xmlns:android=" http://schemas.android.com/apk/res/android" ;>
    <solid android:color="#FF0000FF"/>
    <stroke android:width="4dp" android:color="#FFFFFFFF"
            android:dashWidth="1dp" android:dashGap="2dp" />
    <padding android:left="7dp" android:top="7dp"
            android:right="7dp" android:bottom="7dp" />
    <corners android:radius="4dp" />
</shape>






--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. The mysterious disappearing progress bar...

The following code used to render an indeterminate progress bar with a
message below, all on top of a video view.  Once the video was ready,
the message and the progress bar would be made invisible.  Ever since
cupcake, the progress bar doesn't show at all.  Anyone have any clues?

dk

        private void setupView() {
                LinearLayout lLinLayout = new LinearLayout(this);
            lLinLayout.setId(1);
            lLinLayout.setOrientation(LinearLayout.VERTICAL);
            lLinLayout.setGravity(Gravity.CENTER);
            lLinLayout.setBackgroundColor(Color.BLACK);

            LayoutParams lLinLayoutParms = new LayoutParams
(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT);
            lLinLayout.setLayoutParams(lLinLayoutParms);

            this.setContentView(lLinLayout);


            RelativeLayout lRelLayout = new RelativeLayout(this);
            lRelLayout.setId(2);
            lRelLayout.setGravity(Gravity.CENTER);
            lRelLayout.setBackgroundColor(Color.BLACK);
            android.widget.RelativeLayout.LayoutParams lRelLayoutParms = new
android.widget.RelativeLayout.LayoutParams
(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT);
            lRelLayout.setLayoutParams(lRelLayoutParms);
            lLinLayout.addView(lRelLayout);

            mVideoView = new VideoView(this);
            mVideoView.setId(3);
            android.widget.RelativeLayout.LayoutParams lVidViewLayoutParams =
new android.widget.RelativeLayout.LayoutParams
(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
            lVidViewLayoutParams.addRule(RelativeLayout.CENTER_IN_PARENT);
            mVideoView.setLayoutParams(lVidViewLayoutParams);
            lRelLayout.addView(mVideoView);

            mProgressBar = new ProgressBar(this);
            mProgressBar.setId(4);
            android.widget.RelativeLayout.LayoutParams
lProgressBarLayoutParms = new
android.widget.RelativeLayout.LayoutParams
(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
            lProgressBarLayoutParms.addRule(RelativeLayout.CENTER_IN_PARENT);
            mProgressBar.setLayoutParams(lProgressBarLayoutParms);
            lRelLayout.addView(mProgressBar);

            mProgressMessage = new TextView(this);
            mProgressMessage.setId(5);
            android.widget.RelativeLayout.LayoutParams
lProgressMsgLayoutParms = new
android.widget.RelativeLayout.LayoutParams
(ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT);
            lProgressMsgLayoutParms.addRule
(RelativeLayout.CENTER_HORIZONTAL);
            lProgressMsgLayoutParms.addRule(RelativeLayout.BELOW, 4);
            mProgressMessage.setLayoutParams(lProgressMsgLayoutParms);
            mProgressMessage.setTextColor(Color.LTGRAY);
            mProgressMessage.setTextSize(TypedValue.COMPLEX_UNIT_PT, 8);
            mProgressMessage.setText("...");
            lRelLayout.addView(mProgressMessage);
        }

-- 

2. trust all certs using http client?

i'm trying to use the httpclient.* API in the android SDK to make an 
HTTPS connection. i would like to accept self-signed certs automatically 
(trust all certs) i found references to EasySSLProtocolSocketFactory, 
which is part of standard apache httpclient, but it's not in android.

has anyone tackled this?

-- 

-- 

3. R.layout.main Not Found when running WebView Tutorial

4. Newbie how to run my image in emulator

5. Android Emulator Fail to launch.

6. GPS_EVENT_SATELLITE_STATUS called alot

7. no device