however my text color will not change it's color to black.
I don't know what the problem could be... do you have any idea?
<TextView
android:id="#android:id/empty"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000000"
android:textColorHint="#000000"
android:textSize="14sp"
android:color="#000000" >
EDIT:
My manifest is that:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.blabla.blabla"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="11" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
>
<activity
android:name=".blablabla"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
my styles.xml is empty
<resources>
</resources>
EDIT:
i think i solved my problem..
the solution: Android ListView Text Color
i aded a style:
<style name="ListFont" parent="#android:style/Widget.ListView"> <item name="android:textColor">#000000</item> <item name="android:typeface">sans</item> </style>
and added it in my manifest...
in my activity i used this:
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(getActivity(), R.array.BlaBla, android.R.layout.simple_list_item_1);
i ask myself what exactly "android.R.layout.simple_list_item_1 does? - why my textColor did not worked and why it does work now with a seperate style - do i need to mention simple_list_item_1 then in my activity any more?
thx u guys
Related
How to make RecyclerView item background transparent I need to show background image?
I tried 3 solutions given in Stack Overflow and not worked for me
1 : android:background="?android:attr/selectableItemBackground"<br>
2 : android:background="#android:color/transparent"<br>
3 : alpfha 0.4
udated i also tried
4: android:background="#null" (Answer from this post) and not working
full xml code
Try to give this on your item CardView
app:cardBackgroundColor="#android:color/transparent"
Try this:
1) In your manifest make that activity theme to Transparent-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidhub4you.transparent.background"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="#drawable/logo"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name="com.androidhub4you.transparent.background.MainActivity"
android:theme="#android:style/Theme.transparent"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
2) Now your page will be 100% transparent, so if you need some background color then set opacity like-
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#80000000"
tools:context=".MainActivity" >
it helps you.
So for the layout you are inflating for the item you can use
android:background="#null"
You can also use developer options on your device to see layout bounds or check the view hierarchy to see which item is giving you problems
First add this style in styles.xml
<style name="Theme.Transparent" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowContentOverlay">#null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="colorPrimaryDark">#android:color/transparent</item>
</style>
then add this line in AndroidManifest.xml below the corresponding activity
android:theme="#style/Theme.Transparent"/>
hope it helps.
set all layout backgrouncolor= '#00000000' also to your Recycleview background color to achieve this view
set transparent color in your view
#80000000
I am getting two title bar has below ,i have designed a custom title bar with image and text and used styles.xml to set the theme.I have same titlebar for two screens with different text.
the code are has below
public class ReminderActivity extends Activity {
Context context;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.reminderlayout);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.reminderlayout);
ArrayList<GetReminder> list = (ArrayList<GetReminder>) getIntent().getSerializableExtra("reminderList");
System.out.println("size is >>>"+list.size());
}
}
xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:gravity="center_vertical"
android:orientation="horizontal"
android:background="#drawable/formheader">
<ImageView
android:id="#+id/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_launcher"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Reminder Messages"
android:textColor="#android:color/black"
android:textStyle="bold" />
</LinearLayout>
manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.loginscreen"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="com.example.sampleapp.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.example.sampleapp.ItemActivity"
android:theme="#style/TitleBarTheme" />
<activity
android:name="com.example.sampleapp.ReminderActivity"
android:theme="#style/TitleBarTheme" > </activity>
</application>
</manifest>
and style.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="titleBarHeading" parent="#android:style/TextAppearance">
<item name="android:textSize">17sp</item>
<item name="android:textStyle">bold</item>
<item name="android:textColor">#444444</item>
</style>
<style name="CustomWindowTitleBarBG">
<item name="android:background">#323331</item>
</style>
<style name="TitleBarTheme" parent="android:Theme">
<item name="android:windowTitleSize">35dip</item>
<item name="android:windowTitleBackgroundStyle">#style/CustomWindowTitleBarBG</item>
</style>
</resources>
setContentView(R.layout.reminderlayout);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.reminderlayout);
You are using the same layout file for both the Content View and Title. Create a separate layout files for both
I have themes file to apply all of my buttons. The following coding is in my themes file.
<style name="CustomButton" parent="#android:style/Widget.Holo.Light.Button">
<item name="android:textSize">14sp</item>
<item name="android:layout_width">72dp</item>
<item name="android:layout_height">32dp</item>
<item name="android:background">#drawable/button_selector</item>
</style>
<style name="MyTheme" parent="#android:style/Theme.Holo.Light">
<item name="android:buttonStyle">#style/CustomButton</item>
</style>
In the #drawable/button_selector
<selector>
<item android:drawable="#drawable/btn_bg">
<shape>
<size android:width="72dip" android:height="32dip"/>
<stroke
android:width="1dp"
android:color="#992f2f" />
<corners
android:radius="3dp" />
</shape>
</item>
</selector>
In my layout file
<Button android:id="#+id/savebtn"
android:layout_width="wrap_content" android:layout_marginRight="15dip"
android:layout_height="wrap_content"
android:text="Save"/>
My problem is that the button width and height didn't change. When I set layout_with(72dp) and layout_height(32dp) in the savebtn directly, it works. I have already defined themes file in application tag. I don't want to set all of my buttons like that. I would like to know any suggestions or idea?
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myproject"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="15" />
<application
android:label="#string/app_name"
android:theme="#style/MyTheme">
<activity
android:name=".activity.setting.SettingActivity"
android:label="#string/menu_settings" >
</activity>
<activity
android:name=".activity.setting.AboutActivity"
android:label="#string/app_name" >
</activity>
<activity
android:name=".activity.DetailsActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I tested exactly your code and it worked.
Did you add the following on your AndroidManifest.xml?
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/MyTheme" >
If still doesn't work, please post your manifest!
Also pay attention that if you are setting another theme on your activity, it will override the application theme!
Hi i have to developed one sample app.Here i wish to select the app name is Admin Login and gravity is center.here i have to run the app means the app name is diplayed successfully.but the gravity is not worked for me.here i wish to align the app name is center.how can i do.please give me solutions.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.androidlogin.ws"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="8" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".AndroidLoginExampleActivity"
android:label="Admin Login" android:theme="#style/CustomTheme" android:gravity="center">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Edit:
<style name="CustomWindowTitleBackground">
<item name="android:background">#093f7c</item>
<item name="android:gravity">center</item>
</style>
<style name="CustomTheme" parent="android:Theme">
<item name="android:windowTitleSize">35dip</item>
<item name="android:windowTitleBackgroundStyle">#style/CustomWindowTitleBackground</item>
</style>
I have checked your styles. There you specify
<item name="android:gravity">center</item>
for CustomWindowTitleBackground. Its not possible because setting gravity center means it will align in center to its parent. so there is no possibility of giving the layout width to fill_parent.
so i think you must use custom xml file and align your title
Define a custom title style/theme.
Als o check com.example.android.apis.app.CustomTitle.
Try to set gravity in AndroidLoginExampleActivity.xml file
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:gravity ="center" >
or if you want to use gravity in sub layout then use layout_gravity in sub layout.
I have a tabhost and there is an activity inside. I want this activity to have customized title bar so I used the following code. But it gives the error Cannot combine custom titles with other titles features. I look at the file and see only one theme applied to it, I am not sure why this is happening... Any idea? I am also using dialogtheme for other activities in my tabhost, but I think that is fine because I am applying my custom theme only to one Activity(which is named startActivity).
Manifest:
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name=".MainTabActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".StartActivity"
android:label="#string/app_name"
android:theme="#style/CustomTheme" //this is the Custom title bar theme for this activity
android:screenOrientation="portrait" >
</activity>
Activity onCreate():
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); //error happned here
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
super.onCreate(savedInstanceState);
Log.i(TAG, "onCreate()");
setContentView(R.layout.startactivity);
window_title.xml in layout folder:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="35dip"
android:gravity="center_vertical"
android:paddingLeft="5dip"
android:background="#323331">
<ImageView
android:id="#+id/header"
android:src="#drawable/ic_launcher"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
Finally, the #style:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomWindowTitleBackground">
<item name="android:background">#323331</item>
</style>
<style name="CustomTheme" parent="android:Theme">
<item name="android:windowTitleSize">35dip</item>
<item name="android:windowTitleBackgroundStyle">#style/CustomWindowTitleBackground</item>
</style>
</resources>