2016-07-17 3 views
0

Проблема здесь. Я пытаюсь вставить текстовое изображение в нижнее, используя «alignParentBottom = true», но скрывает текстовое изображение. Ниже приведен макет xml-файла:alignParentBottom скрывает текстовое окно

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:weightSum="1"> 

<Switch 
    android:onClick="adjustFocus" 
    android:layout_margin="10dp" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hhmm" 
    android:id="@+id/hhmm" 
    android:checked="false" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentEnd="true" /> 

<Switch 
    android:onClick="adjustFocus" 
    android:layout_margin="10dp" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hr12" 
    android:id="@+id/hr12" 
    android:checked="false" 
    android:layout_below="@+id/hhmm" /> 

<Switch 
    android:onClick="adjustFocus" 
    android:layout_margin="10dp" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hr24" 
    android:id="@+id/hr24" 
    android:checked="false" 
    android:layout_below="@+id/hr12" /> 
<Switch 
    android:onClick="adjustFocus" 
    android:layout_margin="10dp" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hh_double" 
    android:id="@+id/hhdbl" 
    android:checked="false" 
    android:layout_below="@+id/hr24" /> 
<Switch 
    android:onClick="adjustFocus" 
    android:layout_margin="10dp" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/mm_double" 
    android:id="@+id/mmdbl" 
    android:checked="false" 
    android:layout_below="@+id/hhdbl" /> 



<TextView 
    android:textColor="@color/black" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textAppearance="?android:attr/textAppearanceSmall" 
    android:text="@string/offset" 
    android:id="@+id/textView2" 
    android:layout_below="@+id/mmdbl" 
    android:layout_margin="10dp" /> 


//below is the textview I'm trying to stick to the bottom 
    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     android:text="Large Text" 
     android:id="@+id/textView3" 
     android:background="@color/black" 
     android:textColor="@color/white" 
     android:layout_alignParentBottom="true" 
/> 
</RelativeLayout> 

Ниже приведен код java, связанный с указанным выше XML-файлом. Это фрагмент ...

public class myfrag extends Fragment { 
TextView tv; 
@Override 
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { 
View v = inflater.inflate(R.layout.my_fragment, container, false); 
tv = (TextView)v.findViewById(R.id.textView3); 


return v; 
} 

} 

Пожалуйста, помогите мне, где я ошибаюсь.

+1

вы можете показать скриншот? – Ironman

+0

Текстовое изображение видно в предварительном просмотре, но скрыто во время тестирования на реальном устройстве. Вот скриншоты ... Предварительный просмотр: http://i.imgur.com/E6F5RnP.png ... На реальном устройстве: http: //i.imgur.com/SBNEZ06.png ... Pls checkout оба из них –

+0

Итак, каковы операции, которые вы выполняете в TextView программно в режиме реального времени? !! –

ответ

0

Обновление этого TextView:

<TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceLarge" 
     android:text="Large Text" 
     android:id="@+id/textView3" 
     android:background="#111111" 
     android:textColor="@color/white" 
     android:layout_alignParentBottom="true" 
     android:layout_below="@+id/textView2" 
     android:gravity="center|bottom" /> 
Смежные вопросы