我正在尝试在屏幕的左上角放置进度条。但是,我不太确定哪种方式是最好的方法。我应该以编程方式创建一个进度条,而不是在xml中创建它?或者我应该改变我的布局?谢谢。下面的XML。Android - 在左上角显示进度条
XML代码:布局,当你想在特定区域定位的观点是FrameLayout
或RelativeLayout
RelativeLayout
将让你每个视图相对放置彼此
<?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:background="@drawable/background"
android:focusableInTouchMode="true"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="53dp"
android:layout_marginBottom="5dp"
android:src="@raw/topbar" />
<TextView
android:id="@+id/search_nameOfFeed"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:text="Event Name"
android:textColor="@color/black"
android:textSize="18sp" >
</TextView>
<ListView
android:id="@+id/searchfeed_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="0.83"
android:dividerHeight="10.0sp"
android:fadingEdge="none"
android:stackFromBottom="false"
android:transcriptMode="normal" >
</ListView>
</LinearLayout>