TabWidget white foreground color?
문제
I don't know what I did but for a period of time my TabWidget had white colored tabs which looked really nice. I never set a theme or background/foreground color in my project at all. The next time I compiled it it reverted back to the gray tabs. My application is using the default dark theme. Even if I set the application theme to light, the tabs are still gray. So obviously it was something else that changed the tabs' color. Anyone know how to do this?
해결책
I was having a problem due to a bug in Android 1.6's light theme (tab indicator text is white). I was able to override the default theme as follows:
- I created a custom theme that inherited from the default theme:
styles.xml
:
<style name="MyTheme" parent="@android:style/Theme.Light">
<item name="android:tabWidgetStyle">@style/LightTabWidget</item>
</style>
<style name="LightTabWidget" parent="@android:style/Widget.TabWidget">
<!-- set textColor to red, so you can verify that it applied. -->
<item name="android:textColor">#f00</item>
</style>
Then I just apply that theme to my application by adding android:theme="@style/MyTheme"
to the <application />
element of my AndroidManifest.xml
.
다른 팁
먼저 VS2013을 사용하여 사용하는 계정이 올바른 계정인지 확인하십시오! 당신이 할 수있는 일은 관리자로 열립니다.
Windows 8, Windows 8.1, Windows Server 2012 또는 Windows Server 2012 R2 에 대한 관리 권한이있는 Visual Studio를 실행하려면
1. 시작 화면에서 Visual Studio를 입력하십시오. 설치 한 Visual Studio 버전이나 버전이 표시되어야합니다.
2. 시작하려는 Visual Studio 버전을 선택한 다음 바로 가기 메뉴를 불러옵니다 (화면 하단에 나타납니다). 관리자로 실행을 선택하십시오.
Visual Studio가 시작될 때 (관리자)가 제품 후에 나타납니다. 제목 표시 줄의 이름.
Windows 7 또는 Windows Server 2008 R2 에 대한 관리 권한으로 Visual Studio를 실행하려면
1. 시작 메뉴에서 모든 프로그램을 선택하십시오.
2. Microsoft Visual Studio 버전 폴더 Visual Studio 버전 선택 바로 가기 메뉴를 열고 관리자로 실행을 선택합니다.
Visual Studio가 시작될 때 (관리자)가 제품 후에 나타납니다. 제목 표시 줄의 이름.
http://msdn.microsoft.com/en-us/library/ jj662724.aspx
할 수없는 것보다 실패한 경우 :
SQL Server의 개발 사용자 계정에 sysadmin ' 서버 역할을 부여합니다.
sysadmin 고정 서버 역할의 구성원은 서버.
http://msdn.microsoft.com/en-us/library/ MS188659.aspx
SQL Server sysadmin 권한 부여에 대한 지침
http://support.microsoft.com/kb/2184138
첫 번째 솔루션은 관리자 계정에서 실행 중이므로 설치되어야하며 설치 중에 SOMTHANT가 아닌 한 ..... .....에 이미 묶여있게됩니다! 이 메소드보다 VS를 사용하여 연결할 사용자 (다른 사용자 계정)를 부여하려면 FINE이지만 SYSADMIN을 전체 액세스 권한으로 제공 할 것이고 ADMIN 계정 / 팜 계정만이 그 권위가 있어야합니다! 이 가이드를 따르도록하십시오!
http://technet.microsoft.com/en-us/library/ hh377944.aspx
편집
그냥 분명하게 만드십시오! 로컬 컴퓨터에서 SharePoint 서버에 일반 프로젝트를 연결할 수 없습니다! 나는 그들이 2013 년에 그 능력을 제거했다고 생각합니다. 현재 2012 년에 앱을 배포에 연결할 수있는 앱을 만드는 옵션 만 있음을 유의하십시오!
WebParts와 같은 프로젝트를 만드는 것으로 나타났습니다. 서버 또는 로컬에서 호스팅되는 VM에서 개발해야합니다. VN은 VS2012가 직접 Depoly를 직접 개발하고 직접 개발할 수 있습니다! WSP 및 PowerShell을 사용하는 라이브 서버에서 프로젝트를 실행하려면!
http://msdn.microsoft.com/ko. - / 도서관 / jj163785 (v= Office.15)
in the public void onCreate(Bundle savedInstanceState)
`tabHost = getTabHost();
tabHost.setOnTabChangedListener(this);
tabHost.setCurrentTab(0);
setTabColor();`
than in the listener:
public void onTabChanged(String tabId) { setTabColor();
finally the function, which set the foreground and the background too:
public void setTabColor() {
// set foreground color:
for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {
RelativeLayout rl = (RelativeLayout) tabHost.getTabWidget().getChildAt(i);
ImageView imageView = (ImageView) rl.getChildAt(0);// change it if you want it
TextView textView = (TextView) rl.getChildAt(1);//
textView.setTextColor(Color.parseColor("#FFFFFF"));
}
// set background color:
for (int i = 0; i < tabHost.getTabWidget().getChildCount(); i++) {
tabHost.getTabWidget().getChildAt(i).setBackgroundColor(Color.parseColor("#010101")); // unselected
}
tabHost.getTabWidget().getChildAt(tabHost.getCurrentTab()).setBackgroundColor(Color.parseColor("#121288")); // selected
}
In onCreated() :
tabHost.setCurrentTab(0);
// Set tabs text color to white:
TabWidget tabWidget = tabHost.getTabWidget();
int whiteColor = getResources().getColor(R.color.white);
int someOtherColor = getResources().getColor(R.color.someOtherColor);
for(int i = 0; i < tabWidget.getChildCount(); i++){
View tabWidgetChild = tabWidget.getChildAt(i);
if(tabWidgetChild instanceof TextView){
((TextView) tabWidgetChild).setTextColor(whiteColor);
} else if(tabWidgetChild instanceof Button){
((Button) tabWidgetChild).setTextColor(whiteColor);
} else if(tabWidgetChild instanceof ViewGroup){
ViewGroup vg = (ViewGroup)tabWidgetChild;
for(int y = 0; y < vg.getChildCount(); y++){
View vgChild = vg.getChildAt(y);
if(vgChild instanceof TextView){
((TextView) vgChild).setTextColor(whiteColor);
}
}
vg.setBackgroundColor(someOtherColor);
}
}