Aligning webview and buttons...

by Breezy » Tue, 02 Feb 2010 10:37:24 GMT


Sponsored Links
 I want to put two buttons (not HTML) at the top of my view and the
webview below it...  Almost like frames in HTML, except the top frame
is android XML code, not an HTML frame.  I can get it somewhat like I
want, but whenever the HTML page is too big it goes up and under my
buttons, but at the bottom of the buttons I want the top of the
webview to start, all the time.  And the webview can scroll if
necessary.

Here's what I got, but it's not doing exactly what I was hoping
for....


<RelativeLayout
        xmlns:android=" http://schemas.android.com/apk/res/android" ;
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">

        <RelativeLayout
                android:id="@+id/webviewbox"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
        >

            <WebView
        android:id="@+id/webview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:scrollbars="none"
    />

        </RelativeLayout>
                <Button
                        android:id="@+id/button1"
                        android:text="B1"
                        android:layout_height="wrap_content"
                        android:layout_width="100px"
                        android:layout_alignParentLeft="true"
                />
                <Button
                        android:id="@+id/button2"
                        android:text="B2"
                        android:layout_height="wrap_content"
                        android:layout_width="100px"
                        android:layout_alignParentRight="true"
                />

</RelativeLayout>

--



Aligning webview and buttons...

by Breezy » Wed, 03 Feb 2010 01:56:01 GMT


 Anyone have anything?




--


Sponsored Links


Other Threads

1. ListView/ ScrollView : What exactly is happening in onInterceptTouchEvent()

I know that we are not supposed to put a listView inside of a
scrollView.  The layout  and nesting of my apps views are determined
at run time and I have no control over that.My situation demands it
and I have a working implementation to achieve that.  However I am not
sure what exactly is happening in  onInterceptTouchEvent().

I am returning false from onTouchEvent() ,of scrollView, if the
MotionEvent occurred within the bounds of the listView, thus the event
is passed down to my listView to handle. So if I touch and drag
outside the listView my outer scrollView scrolls, else if I touch and
drag on the listView, the listView scrolls. They dont compete for
scrolling anymore. This is all possible only if I always return false
from the  onInterceptTouchEvent() of the scrollView. In the default
implementation it returns true if it is being dragged. My solution
breaks if I return true from here for any condition. Is it ok to
simply return false all the time from  onInterceptTouchEvent()? I have
tried scrolling in several ways and both the scrollview and the
listView are scrolling as expected when I return false.

A standalone listView also works fine when I simply return false from
its onInterceptTouchEvent() instead of  returning  super(AbsListView).
onInterceptTouchEvent()

Anyone has any scenario when the scrolling might not work?

thanks,
vk

-- 

2. Weird Camera Intent behavior

Hi all.

I'm invoking the MediaStore.ACTION_IMAGE_CAPTURE intent with the
MediaStore.EXTRA_OUTPUT extra so that it does save the image to that
file.



On the onActivityResult I can check that the image is being saved in
the intended file, which is correct. The weird thing is that anyhow,
the image is also saved in a file named something like
"/sdcard/Pictures/Camera/1298041488657.jpg" (epoch time in which the
image was taken).

 I've checked the Camera app source (froyo-release branch) and I'm
*almost* sure that the code path is correct and wouldn't have to save
the image, but I'm a noob and I'm not completly sure. AFAIK, the image
saving process starts with this callback (comments are mine):

private final class JpegPictureCallback implements PictureCallback {
...
    public void onPictureTaken(...){
        ...
        // This is where the image is passed back to the invoking activity.
        mImageCapture.storeImage(jpegData, camera, mLocation);
        ...

        public void storeImage(final byte[] data,
                android.hardware.Camera camera, Location loc) {
            if (!mIsImageCaptureIntent) {      // Am i an intent?
                int degree = storeImage(data, loc); // THIS SHOULD NOT
BE CALLED WITHIN THE CAPTURE INTENT!!
             .......

       // An finally:
        private int storeImage(byte[] data, Location loc) {
            try {
                long dateTaken = System.currentTimeMillis();
                String title = createName(dateTaken);
                String filename = title + ".jpg";  // Eureka,
timestamp filename!
                 ...

So, I'm receiving the correct data, but it's also being saved in the
"storeImage(data, loc);" method call, which should not be called...


It'd not be a problem if I could get the newly created filename from
the intent result data, but I can't. When I found this out, I found
about 20 image files from my tests that I didn't know were on my
sdcard :)

I'm getting this behavior both with my Nexus One with Froyo and my
Huawei U8110 with Eclair.

Could please anyone enlight me? Dianne? ;)

Thanks a lot.

-- 

3. Which is the best way to implement double buffering?

4. Spaces in links to Android Developers reference

5. Problem with WebView

6. Honeycomb SDK

7. Does Android have a LinkButton. Basically like text but you click on it?