[英]Trying to create a webview with progress bar and bottom tab
Below is my Code. 下面是我的代码。 I am not able to display the include element which is the tab in the bottom part of the page properly.It gets hidden.
我无法正确显示include元素,该元素是页面底部的选项卡。它被隐藏了。 Any suggestions would be welcome.
欢迎大家提出意见。 Take a look at the code and let me know.
看一下代码,让我知道。
<LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/header_yellow" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="10dip"
android:orientation="horizontal" >
</LinearLayout>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/logo" />
<LinearLayout
android:layout_width="68dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="10dip" >
<ImageView
android:id="@+id/webview_scan_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:onClick="onScanner"
android:src="@drawable/barcode_icon" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/layout1"
android:layout_width="wrap_content"
android:layout_height="450dp"
>
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
/>
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<include layout="@layout/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
Although your question/desirable output are not clear, try this 尽管您的问题/所需的输出不清楚,请尝试执行此操作
<LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#aaaaaa" >
<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
<ImageView
android:id="@+id/webview_scan_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toLeftOf="@+id/progressBar1"
android:onClick="onScanner"
android:src="@android:drawable/ic_menu_search" />
<ImageView
android:id="@+id/webview_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@android:drawable/ic_menu_info_details" />
</RelativeLayout>
<WebView
android:layout_below="@+id/webview_scan_button"
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<include layout="@layout/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
You can customize your tub as you want, for examle: 您可以根据需要自定义浴缸,例如:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tabsLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bg_tab_gradient"
android:gravity="center"
android:orientation="vertical"
tools:ignore="contentDescription" >
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/progressBar" />
<ImageView
android:id="@+id/tab_icon"
android:layout_marginTop="4dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/tab_text"
android:layout_marginBottom="3dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/tab_text_color"/>
</LinearLayout>
using this examle you can use this layout and create Tabs at bottom: https://stackoverflow.com/a/23150258/2765497 使用此示例,您可以使用此布局并在底部创建选项卡: https : //stackoverflow.com/a/23150258/2765497
for support api<11 replace TabView to FragmentTabVeiw and add enother imports from Sherlock of Support library 对于支持api <11,将TabView替换为FragmentTabVeiw,并从支持库的Sherlock添加其他导入
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.