2012-01-02 56 views
0

由于某种原因,我的图像按钮保持重叠。当我使用顶部的滚动视图时,它正常工作,一切都很好,但我不想向下滚动,看看我点击了多少次。我只想在屏幕底部显示文本视图,而图像按钮没有重叠,我imageButton不断重叠我想要在屏幕底部的文本视图

我在做什么错? 这是我尝试新事物

<?xml version="1.0" encoding="utf-8"?> 


    <LinearLayout 
     android:id="@+id/LinearLayout01" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical"> 

    <!-- Stretching frame layout using weights will bring it to the bottom --> 


    <TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/pushme" 
    android:textSize="21sp" 
    android:gravity="center_horizontal|center_vertical" 
    android:textColor="#ff0005" 
    android:background="#ff99ff" 

    /> 



    <Button 
    android:id="@+id/button" 
    android:scaleType="fitCenter" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/push" 


    /> 


<FrameLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="0dip" 
    android:layout_gravity="bottom" 
    android:layout_weight="1" 
    android:layout_below="@+id/numClicked" 
    > 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:padding="8dip" 
     android:text="@string/numClicked" 
     android:background="#ffffffff" 
     android:textColor="#ff127223" 

     /> 

    </FrameLayout> 



    </LinearLayout> 

现在这是我使用它使用滚动视图,但我不想滚动视图

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView 
     android:id="@+id/LinearLayout01" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical"> 
<LinearLayout 
     android:id="@+id/LinearLayout01" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical"> 

    <!-- Stretching frame layout using weights will bring it to the bottom --> 


    <TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/pushme" 
    android:textSize="21sp" 
    android:gravity="center_horizontal|center_vertical" 
    android:textColor="#ff0005" 
    android:background="#ff99ff" 

    /> 



    <Button 
    android:id="@+id/button" 
    android:scaleType="fitCenter" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/push" 


/> 


<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="0dip" 
    android:layout_gravity="bottom" 
    android:layout_weight="1" 

    > 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:padding="8dip" 
     android:text="@string/numClicked" 
     android:background="#ffffffff" 
     android:textColor="#ff127223" 

     /> 

+0

您的这些布局不完整。它没有显示你在说什么。使其正确,否则无法解决它。 – Debarati 2012-01-02 06:54:32

+0

您的布局中的图像按钮在哪里。老兄,我看不到任何图像按钮标签在那里.. – AAnkit 2012-01-02 06:55:34

回答

1

试试这个,我不得不改变一些东西在我的模拟器上看到它,但你可以得到它的要点。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout android:id="@+id/LinearLayout01" 
android:layout_width="fill_parent" android:layout_height="fill_parent" 
xmlns:android="http://schemas.android.com/apk/res/android"> 

<LinearLayout android:layout_width="fill_parent" 
    android:orientation="vertical" android:layout_above="@+id/numClicked" 
    android:layout_height="fill_parent"> 

    <TextView android:layout_width="fill_parent" 
     android:layout_height="wrap_content" android:text="pushme" 
     android:textSize="21sp" android:gravity="center_horizontal|center_vertical" 
     android:textColor="#ff0005" android:background="#ff99ff" /> 

    <ImageButton android:src="@drawable/push" 
     android:layout_width="fill_parent" android:id="@+id/button" 
     android:layout_height="wrap_content" android:layout_gravity="center" /> 

</LinearLayout> 

<TextView android:layout_width="fill_parent" android:id="@+id/numClicked" 
    android:layout_height="wrap_content" android:padding="8dip" 
    android:text="numClicked" android:layout_alignParentBottom="true" /> 

</RelativeLayout> 
+0

是的,它确实工作,当我改变它,谢谢 – 2012-01-02 07:02:40

+1

很酷,请点击接受答案按钮,以便其他人不会继续回答 – 2012-01-02 07:05:57

+0

先生它在我的图形在xml文件中布局,而不是在电话上 – 2012-01-02 07:27:01

0

//我不明白你的问题?

你可以试试这一次是否这会解决你的问题。

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/LinearLayout01" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" > 

     <!-- Stretching frame layout using weights will bring it to the bottom --> 

     <TextView 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:background="#ff99ff" 
      android:gravity="center_horizontal|center_vertical" 
      android:text="pushme" 
      android:textColor="#ff0005" 
      android:textSize="21sp" /> 

     <ImageView 
      android:id="@+id/button" 
       android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:src="@drawable/apps_icon" 
      android:layout_weight="1" 
      android:scaleType="center" /> 

     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" > 

      <TextView 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       android:background="#ffffffff" 
       android:padding="8dip" 
       android:text="numClicked" 
       android:textColor="#ff127223" /> 
     </LinearLayout> 
    </LinearLayout> 
+0

是的,它实际上工作时,我改变它,谢谢 其实我刚刚运行它,现在我即将得到一个力量关闭? – 2012-01-02 07:13:36

0

如果我得到它是正确的?你有按钮那里..和你设置背景图像..如果是!然后添加下面的按钮标签代替您的布局中的按钮标签..所有最好的

<Button 
android:id="@+id/button" 
android:scaleType="fitCenter" 
android:layout_width="fill_parent" 
android:layout_height="60dp" 
android:layout_marginBottom="10dp" 
android:background="@drawable/push" 


/> 
相关问题