在android的imageview上拖放textview
我尽了最大努力,谁能帮我在android的imageview上拖放文本视图 我的xml与框架布局在android的imageview上拖放textview,android,Android,我尽了最大努力,谁能帮我在android的imageview上拖放文本视图 我的xml与框架布局 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:layout_width="fill_p
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="center"
android:src="@drawable/golden_gate" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="20dip"
android:layout_gravity="center_horizontal|bottom"
android:padding="12dip"
android:background="#AA000000"
android:textColor="#ffffffff"
android:text="Golden Gate" />
</FrameLayout>
试着使用框架布局它应该知道你想要什么。试着使用框架布局它应该知道你想要什么。像这样使用相对论。注意:您可以将其放置在ParentView中
<RelativeLayout android:layout_width="100dp" android:id="@+id/photoframe" android:layout_height="320dp" android:layout_weight="1.0">
<ImageView android:layout_height="fill_parent" android:scaleType="fitXY" android:id="@+id/framephoto" android:src="@drawable/icon" android:layout_width="fill_parent"></ImageView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:id="@+id/textView1" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="188dp"></TextView>
</RelativeLayout>
在layout.xml中。使用Relative可以将文本视图拖动到图像上。像这样使用RelativeLayout。注意:您可以将其放置在ParentView中
<RelativeLayout android:layout_width="100dp" android:id="@+id/photoframe" android:layout_height="320dp" android:layout_weight="1.0">
<ImageView android:layout_height="fill_parent" android:scaleType="fitXY" android:id="@+id/framephoto" android:src="@drawable/icon" android:layout_width="fill_parent"></ImageView>
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:id="@+id/textView1" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_marginTop="188dp"></TextView>
</RelativeLayout>
在layout.xml中。使用Relative可以将文本视图拖动到图像上。请尝试一下这个
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/ic_launcher" android:scaleType="center" />
<TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:background="#AA000000" android:textColor="#ffffffff" android:text="Golden Gate"/>
</FrameLayout>
我用我的eclipse检查了它。让我知道它是否工作。请试试这个
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView android:id="@+id/imageView1" android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/ic_launcher" android:scaleType="center" />
<TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:background="#AA000000" android:textColor="#ffffffff" android:text="Golden Gate"/>
</FrameLayout>
我用我的eclipse检查了它。让我知道它是否工作。你能发布你的布局吗?你的代码现在正在我的eclipse上工作,但是有一个绘图功能如果我使用框架布局,我不能在图像上拖放文本视图。你能发布你的布局吗?你的代码现在正在我的eclipse上工作,但是有一个绘图功能如果我是使用框架布局我不能在图像上拖放文本视图我使用了框架布局n和线性布局,但我不能在图像上拖放文本请告诉我您可以使用哪个构建api级别?或者您的目标api级别我有一个api级别11或更高版本的演示。我使用了框架布局n和线性布局,但我不能在图像上拖放文本图片请告诉我您可以使用哪种构建api级别?或者您的目标api级别我有一个api级别11或更高版本的演示。