I am playing around with the smart mirror code and when I build and run the app on a Android TV AVD, the app makes all the info on the screen too close. The app shown in the Github website has is all neat and spread out but mine as shown below is all together.
Is there a setting I forgot to change?
Try to add this line in activity_home.xml to control your textSize
,the example set 30sp, you can set other what you need.
Example
<TextView
android:id="#+id/news_1"
style="#style/NewsStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="left"
android:layout_marginBottom="#dimen/intra_group_margin"
android:drawableLeft="#drawable/news_ap"
android:drawablePadding="#dimen/icon_margin"
add > android:textSize = "30sp"
tools:text="Obama, Sanders at the White House: Nice chat but that's all"/>
Related
I'm wondering if there was a way to move shown GUI's elements of any app on screen (for example to place them at the bottom).
For example I would like to change layout and elements' alignment in Facebook app or Instagram without using root.
I would like to get something like "Force RTL layout" but using it to align elements from bottom:
At least, I want get and edit GUI's elements' size and layout as this Android Developer Tool does:
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layoutDirection = "ltr" //ltr - Left-to-Right
or
android:layoutDirection="rtl" //rtl - Right-to-Left
android:text="hello" />
The social icons below (for fb, twitter, mail and share) are circular PNGs with transparent backgrounds. When I use the code and exact same images in Eclipse, I get transparent background but when build and run with Android Studio, I get black backgrounds. See details below.
Images are the same. Code used in layout xml files:
<LinearLayout
android:id="#+id/ll_shareBtns"
android:layout_width="#dimen/sharesection_width"
android:layout_height="#dimen/sharesection_height"
android:layout_gravity="center"
android:background="#drawable/bg_sharebox"
android:gravity="center"
android:orientation="horizontal" >
<Button
android:id="#+id/btn_facebook"
android:layout_width="#dimen/dimens_sharebtns"
android:layout_height="#dimen/dimens_sharebtns"
android:layout_marginLeft="#dimen/sharebtns_leftmargin"
android:layout_marginRight="#dimen/sharebtns_rightmargin"
android:background="#drawable/bg_facebookbtn"
android:gravity="center" />
<Button
android:id="#+id/btn_twitter"
android:layout_width="#dimen/dimens_sharebtns"
android:layout_height="#dimen/dimens_sharebtns"
android:layout_marginLeft="#dimen/sharebtns_leftmargin"
android:layout_marginRight="#dimen/sharebtns_rightmargin"
android:background="#drawable/bg_twitterbtn"
android:gravity="center" />
<Button
android:id="#+id/btn_email"
android:layout_width="#dimen/dimens_sharebtns"
android:layout_height="#dimen/dimens_sharebtns"
android:layout_marginLeft="#dimen/sharebtns_leftmargin"
android:layout_marginRight="#dimen/sharebtns_rightmargin"
android:background="#drawable/bg_emailbtn"
android:gravity="center" />
<Button
android:id="#+id/btn_share"
android:layout_width="#dimen/dimens_sharebtns"
android:layout_height="#dimen/dimens_sharebtns"
android:layout_marginLeft="#dimen/sharebtns_leftmargin"
android:layout_marginRight="#dimen/sharebtns_rightmargin"
android:background="#drawable/bg_sharebtn"
android:gravity="center" />
</LinearLayout>
When code compiled and run with Android Studio, I see this:
When code is compiled and run with Eclipse, I see this:
Quite Strange. Could difference in build tools version cause this problem too?
Its seems to be problem in Theme used in xml file .
-check it once if the theme is different in eclipse and Android Studio then you can correct it.
by changing the Theme on file style.xml
Hope this will helpful .thanks
Did you try testing your app in a device? This is a known bug with Android Studio where icon PNGs show a black box despite being transparent. I faced the same issue where I saw a black box background in Android Studio layout design preview but the image rendered correctly in the device.
This link can give you more confidence - ic_stop_white_*dp.png background is black, not transparent
Hello stackoverflowers!
This is my button:
<Button
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.30"
android:text="#string/menu_button_newgame"
android:id="#+id/button_newgame"
/>
when I set it's alpha to 150 with
button_newgame.getBackground().setAlpha(150);
it starts looking weird on 2.2! On 2.3.3 the buttons look normally.
Android 2.3.3: (normal)
Android 2.2: (buggy)
What to do ?? :)
It seems to be a problem with the nine-patch.
Try to use
android:layout_height="wrap_content"
All the buttons has the same content and they should keep the same height.
Or try to create a custom nine-patch drawable to use as background.
I have created an Editbox in XML using this code:
<EditText
android:id="#+id/txtEmail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="50dp"
android:inputType="textEmailAddress" >
</EditText>
The textbox renders like this:
How can I get the native android EditText with the orange borders when focused, white background etc. ?
I tried adding
android:background="#android:color/white"
but that only changes the background to white.
The style you are seeing is "native" for the Honeycomb (3.0) Android version, specifically, the new Holo-dark theme. The orange-borders-and-white-background look was last used in 2.3.* and has since been left behind.
Agree with the answer of neutrino: The style you are seeing is "native" for the Honeycomb (3.0) Android version, specifically, the new Holo-dark theme.
But still if you wants the EditText that you want then you need to set the style/theme inside the AndroidManifest.xml file:
<activity android:theme="#android:style/Theme.Light">
when we add view's from layout, it renders from framework, then add the properties we provided . so in your code, EditText is native EditText, which varies from device to device . so if you want look and feel over a particular device make your own style for that and use it .
Had the same problem...
Try using:
EditText usr=(EditText)findViewById(R.id.editText1);
usr.setBackgroundResource(17301528);
If you really want to older versions of the EditText iamges (from sdk/android-8/platforms/data/res folder), place thema in the drawable folder, create a StateListDrawable out of it, and set the background of the EditText as that Drawable. But why bother ? Let app users enjoy the default look and feel of their device.
am an upcoming android developer. I have my app in eclipse running on 2.2 android platform and the only thing remaining is adding fancy buttons to it. I have designed some buttons using photoshop but my main problem is to get the right dimensions (width, height and pixels) for my button so that they can fit properly on the screen. Please help! Thank you.
lucky for you, android sdk comes with a tool that allows you to adjust which parts of your image can be stretched, and which shouldn't be (as i'm thinking that's what you're worrying about). it's called 9-patch, and you can read about it here
What you have to do is play with your .xml file. You have to adjust your Buttons's properties like width and height and that will do.
Start playing with this for example:
<?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="fill_parent"
android:orientation="vertical" >
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:height="50sp"
android:width="100sp"
android:background="#drawable/my_image"
android:text="I'm a button"
/>
</LinearLayout>
I recommend you this reading:
Android Button