我认为解决方案很显然,但由于我是安卓的新手,请见谅 :)
我想在视图的右上方放置一些图片和一个文本视图,该文本视图将适合视图的其余部分。这是我的操作:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/logo_in_listing"
android:layout_width="100dip"
android:layout_height="100dip"
android:layout_alignParentRight="true"
android:layout_marginRight="11dip"
android:layout_marginTop="11dip"
android:background="@drawable/border_for_imageview"
android:src="@drawable/facebook_logo" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/someString"
android:id="@+id/textview1"
android:layout_toLeftOf="@id/logo_in_listing"
android:layout_margin="3dip"/>
</RelativeLayout>
这是我的理解:
我得到了以下内容:
我的问题:
1) 如何使TextView也适合ImageView下部?我不希望那里的空间被浪费。
2) 正如您所见,我使用了dip来放置ImageView。在这种情况下,您会推荐什么?我的意思是,如何编写以便所有屏幕大小都相同?或者使用dip可以吗?
dp
和dip
是同一回事。 - user1435913