我有以下佈局。我需要的是一個位於左側角落的文本框,稍後我會插入一個計數器,以顯示地圖將在幾秒鐘後刷新。Android textview邊框覆蓋頂部地圖的大面積
<RelativeLayout 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" >
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/map"
tools:context="com.example.ns.appversion1.MapActivityFragment1"
android:name="com.google.android.gms.maps.SupportMapFragment"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="96dip"
android:orientation="vertical"
android:weightSum="2" >
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="left"
android:background="@drawable/border"
android:text="Refreshing 1"
android:textColor="#000"
android:textSize="12sp" />
</LinearLayout>
</FrameLayout>
</RelativeLayout>
這裏是border.xml。現在的問題,我只是想邊界附近的單詞,但在這裏它邊界整個頂部區域。我想限制在單詞之內。
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >
<stroke
android:width="2dp"
android:color="#0288D1" />
</shape>
「我只想邊境周圍這個詞「意味着什麼?您正在將它應用於textView而不是用於單詞 –
的單詞。但是,當我應用它時,它獲得整個文本視圖,它看起來很難看 – user5313398
然後扭曲視圖或發佈預期的輸出 –