0

here is the sample image i want to do..so i need the bottom menus.I am working with android app..I created a web view.Now I want to add top and bottom menu bar like header and footer to my app.. my app start with a splash screen..then followed by web view .how can I add these menu to top and bottom of these web view..??? please help me and thanks.

here is my xml

      <?xml version="1.0" encoding="utf-8"?> 
     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent"
     android:id="@+id/layout"
        > 
       <ImageView 
            android:layout_width="fill_parent" 
            android:layout_height="fill_parent" 
            android:scaleType="center" 
            android:src="@drawable/appinc" 
            android:visibility="visible" 
        /> 
       <WebView android:id="@+id/webview" 
        android:layout_height="fill_parent" 
        android:layout_width="fill_parent" 
        android:visibility="gone" 
        />

      <ProgressBar
        android:id="@+id/progressBar1"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="114dp" />

   </RelativeLayout> 
Dharman
  • 30,962
  • 25
  • 85
  • 135

4 Answers4

0

If you are taking about option menu no you cannot change position of menus. See this: https://stackoverflow.com/a/8236188/2741586

However you can actually split you action bar(in 4.0+ versions or older usingmActionBarSherlock). By splitting action bar, menu will appear in both top and button like this: enter image description here.

If this is what you want: Follow this link

UPDATE: I found another option! If you want menu like this Google Play If you want these overflow 3 dot icons: Follow this link.

If none of these suits with your need, you should probably create custom view and modify according to your choice!

Hope this helps!

Community
  • 1
  • 1
Bipin Bhandari
  • 2,694
  • 23
  • 38
  • After long search this is probably your only option http://stackoverflow.com/questions/16427360/add-menu-on-every-listview-item. Please see images posted by the guy who posted the question. I would update my answer too. – Bipin Bhandari Jan 11 '14 at 11:19
  • I wnt to add menu like the link https://play.google.com/store/apps/details?id=com.amidray.blockout –  Jan 11 '14 at 11:35
  • It can be exactly be achieved using split action bar as I recommended earlier. I think they have also used this feature. After using split action bar you have to add custom action bar and use use custom action buttons and custom to achieve that UI. Please refer http://developer.android.com/guide/topics/ui/actionbar.html for detail information and everything you need to know about actionbar. Thank you! – Bipin Bhandari Jan 11 '14 at 11:53
  • @ptm where is the image? – Bipin Bhandari Jan 11 '14 at 11:56
  • check the question again –  Jan 11 '14 at 11:59
  • Ok that's split action bar – Bipin Bhandari Jan 11 '14 at 12:04
0

To apply in your xml try:

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

    <ImageView
        android:id="@+id/image"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:scaleType="center"
        android:src="@drawable/appinc"
        android:visibility="visible" />

    <LinearLayout
        android:id="@+id/bottom_bar"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:layout_alignParentBottom="true"
        android:background="#550055" >
    </LinearLayout>

    <ProgressBar
        android:id="@+id/progressBar1"
        style="?android:attr/progressBarStyleHorizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_above="@id/bottom_bar" />

    <WebView
        android:id="@+id/webview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@id/progressBar1"
        android:layout_below="@id/image"
        android:visibility="visible" />

</RelativeLayout>
Niko
  • 8,093
  • 5
  • 49
  • 85
0

You should use the android:layout_weight="0dp"

Beginner
  • 85
  • 10
0

Android gives us many components to make a fast and premium application. TextView, ImageView, etc are the general and important components in android. In this tutorial, you will read to add a border to the top and bottom of an Android view. Border to the android views can be added in several ways. Here, I am going to show the easiest and simplest method to add the border to the Android [TextView, Button] views. So, Just Check this below carefully/.

You need to build an XML drawable file inside res/drawable directory For adding the border. This is worked in android 2.2 and higher.

Adding Border to the Top and Bottom of an Android View

Step By Step Guide to Add Border to the Top and Bottom of an Android View

#1: XML Drawable File

First, you need to create an XML drawable file border_top_bottom.xml in /res/drawable folder like /res/drawable/border_top_bottom.xml and link it to TextView. Your drawable XML file will look like this.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape android:shape="rectangle">
            <stroke
                android:width="2dp"
                android:color="#e10606" />
            <solid android:color="#9bce64" />
        </shape>
    </item>

    <item
        android:bottom="2dp"
        android:top="2dp">
        <shape android:shape="rectangle">
            <stroke
                android:width="2dp"
                android:color="#9bce64" />
        </shape>
    </item>

</layer-list>

border_top_bottom.xml hosted with ❤ by GitHub

#2: XML Layout File

Following is the content of XML layout file where I have added a TextView.

res/layout/top_bottom_border_in_android_view.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_margin="16dp"
    android:orientation="vertical">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Adding Border in Top and Bottom of View" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:background="@drawable/border_top_bottom"
        android:padding="30dp"
        android:text="Top Bottom Border in TextView"
        android:textColor="#000000"
        android:textSize="18sp" />

    <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="16dp"
        android:background="@drawable/border_top_bottom"
        android:text="Top Bottom Border in Button" />

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:autoLink="web"
        android:gravity="center|bottom"
        android:text="ViralAndroid.com"
        android:textSize="25sp"
        android:layout_marginTop="8dp"
        android:textStyle="bold" />
</LinearLayout>

top_bottom_border_in_android_view.xml hosted with ❤ by GitHub

#3: Strings.xml File

res/values/strings.xml

<resources>
  
    <string name="app_name">Adding Border to the Top and Bottom of an Android View</string>
    
</resources>

strings.xml hosted with ❤ by GitHub

Now, run your Adding Border to the Top and Bottom of an Android View application, you will see the border at the top and bottom of TextView.

A J
  • 3,970
  • 14
  • 38
  • 53