2013-05-14 2 views
0

AlertDialog에 대한 맞춤 레이아웃을 만들었고 정상적으로 작동합니다. 하지만 내 레이아웃의 텍스트 스타일에 문제가 있습니다. Android : 맞춤 AlertDialog의 텍스트 색이 다릅니다

내에 AlertDialog의 레이아웃입니다 :

<?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" > 

    <TextView 
     android:id="@+id/namedialoglable" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
     android:text="@string/profilename" /> 

    <EditText 
     android:id="@+id/namedialoginput" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:layout_below="@+id/namedialoglable" 
     android:layout_marginTop="24dp" 
     android:ems="10" 
     android:selectAllOnFocus="true" 
     android:text="@string/defaultname" > 

     <requestFocus /> 
    </EditText> 

</RelativeLayout> 

문제는 기본에 AlertDialog에 텍스트가 흰색이고, 내 사용자 지정 대화 상자에서 검은 점이다. 난 그냥 다른 AlertDialog에 사용되는 동일한 색상을 사용하고 싶습니다.

어떻게 수행하나요?

편집 더 명확하게하려면 내가 흰색으로 내 사용자 지정 대화 상자의 색상을 강요하지, 아버지의 텍스트 색상을 유지합니다. 내 생각에 AlertDialog 사용 시스템 색상, 같은 색

답변

0

을 유지하기 위해 내 경보 필요 그래서 왜 그냥 적용 습관 :

android:textColor="@android:color/white" 

을에 Views 당신이 동안 텍스트 색상과 함께합니다.

또한 당신이 wnat 무엇을 달성하기 위해 스타일과 테마를 들여다 : 내 경우에는

http://developer.android.com/guide/topics/ui/themes.html#PlatformStyles

+0

하지만 흰색이 더 명확하도록하려면 다른 대화 상자와 동일한 색상을 사용하고 싶지는 않습니다. 예를 들어 안드로이드 4에서는 대화 상자가 검은 색 텍스트로 흰색이고, 나는 아버지 클래스에서 색을 유지하고 싶습니다! – Ivan

+0

다음 스타일 및 테마를 살펴볼 수 있습니다. http://developer.android.com/guide/topics/ui/themes.html#PlatformStyles –

0

좋아, 내가 다른 해결책을 찾아 냈다. 나의 필요는 메시지 및 대화 상자에 입력 텍스트를 가지고 있기 때문에 는 가장 좋은 방법은 다음과 같이 만 글고 치기와 레이아웃을 생성하는 것입니다

<?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" > 

    <EditText 
     android:id="@+id/namedialoginput" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true"   
     android:layout_marginTop="24dp" 
     android:ems="10" 
     android:selectAllOnFocus="true" 
     android:text="@string/defaultname" > 

     <requestFocus /> 
    </EditText> 

</RelativeLayout> 

을 그리고 메시지 텍스트를 들어,를 사용하여 빌더 메소드 : setMessage :

builder.setView(content) 
     .setTitle("Profile Name") 
     .setMessage(R.string.profilename); 

이렇게하면 다른 대화 상자 형식을 유지할 수 있습니다.

관련 문제