I have created a new xml file in the res>layout forlder called tabs.xml. It has the following code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
androidrientation="vertical" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
androidrientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/Network"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Channel Type:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RadioButton
android:id="@+id/urbanButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:text="Urban" />
<RadioButton
android:id="@+id/suburbanButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/urbanButton1"
android:layout_alignBottom="@+id/urbanButton1"
android:layout_centerHorizontal="true"
android:text="SubUrban" />
<RadioButton
android:id="@+id/ruralButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/suburbanButton2"
android:layout_alignBottom="@+id/suburbanButton2"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:text="Rural" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/urbanButton1"
android:text="Characteristics of Channel:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignRight="@+id/suburbanButton2"
android:layout_below="@+id/textView2"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView3"
android:layout_toLeftOf="@+id/ruralButton3"
android:text="Manual Override" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/power"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/Connectivity"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/Offline"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
</FrameLayout>
</LinearLayout>`enter code here`
</TabHost>
</LinearLayout>
Now i also have a andoid activity_main.xml in the same folder which i added nothing to it. i also created a java file called Tabs.Java and put it in the src folder under src>com.example.qosmetre>Tabs.Java with the following code
package com.example.qosmetre;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class Tabs extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tabs);
}
}
Now my question is, when i run my app on the terminal or in debugging mode, how come nothing is showing up but a blank screen? Like i want the tabs to show up first thing with all the stuff underneath them as shown in the code above. Also how would i import a library for scatter plotting data that would be in my app?
I need to know where and what files to put what code in because im just a beginner and i dont know too much so ill need big guidence.
Thanks again in advance.
Related
Hi! I'm modding my Mms.apk and I've added some speech bubbles etc. I want to place the avatar pic on the bottom of the layout, not on the top. I've tried diferent android:layout_gravity="bottom" but I haven't solved my problem...
Check the code please and tell me how to align avatar on bottom...
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.android.mms.ui.MessageListItem android:orientation="horizontal" android:id="@id/msg_list_item_recv" android:background="#00000000" android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="vertical" android:id="@id/mms_layout_view_parent" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0">
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
<view android:id="@id/avatar" android:layout_width="@dimen/avatar_width_height" android:layout_height="@dimen/avatar_width_height" android:layout_alignParentLeft="true" class="com.android.mms.ui.QuickContactDivot" position="right_middle" android:layout_gravity="fill_vertical" android:layout_gravity="bottom"
xmlns:android="http://schemas.android.com/apk/res/android" />
<LinearLayout android:orientation="vertical" android:id="@id/message_block" android:background="@drawable/listitem_background" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minHeight="@dimen/avatar_width_height" android:layout_toRightOf="@id/avatar" android:layout_alignParentRight="false">
<TextView android:textAppearance="?android:textAppearanceSmall" android:textSize="16.0sp" android:textColor="@android:color/black" android:autoLink="all" android:linksClickable="false" android:id="@id/text_view" android:paddingLeft="@dimen/message_item_text_padding_left_right" android:paddingTop="@dimen/message_item_text_padding_top" android:paddingRight="@dimen/message_item_text_padding_left_right" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8.0dip">
<TextView android:textAppearance="?android:textAppearanceSmall" android:textColor="#ff6f6f6f" android:id="@id/date_view" android:background="#00ffffff" android:paddingLeft="@dimen/message_item_text_padding_left_right" android:paddingRight="3.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<ImageView android:id="@id/locked_indicator" android:paddingRight="3.0dip" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_lock_message_sms" />
<ImageView android:id="@id/delivered_indicator" android:paddingRight="3.0dip" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_sms_mms_delivered" />
<ImageView android:id="@id/details_indicator" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_sms_mms_details" />
</LinearLayout>
<ViewStub android:id="@id/mms_layout_view_stub" android:layout="@layout/mms_layout_view" android:layout_width="fill_parent" android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<ViewStub android:layout_gravity="center_vertical" android:id="@id/mms_downloading_view_stub" android:layout="@layout/mms_downloading_view" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</com.android.mms.ui.MessageListItem>
Please don't let this get lost in the forums.. I just need a dev to look at the code and tell me where I should put Android gravity to make avatar align on bottom.. Please
hi i also modifying.. that but i cant put it in the bottom
please help us to do this..
Sent from my MyPhone A848 Duo using XDA Premium 4 mobile app
I'm on ICS and I've modded my status_bar_tracking.xml to look like this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.phone.TrackingView android:orientation="vertical" android:paddingLeft="0.0px" android:paddingRight="0.0px" android:paddingBottom="0.0px" android:focusable="true" android:visibility="gone" android:descendantFocusability="afterDescendants"
xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]">
<FrameLayout android:background="@drawable/notification_tracking_bg" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0">
<TextView android:paddingLeft="20.0dip" android:paddingBottom="20.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="left|center" android:layout_gravity="bottom" android:text="@string/ticklefish1" />
<TextView android:paddingBottom="20.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="center" android:layout_gravity="bottom" android:text="@string/ticklefish2" />
<com.android.systemui.statusbar.phone.CarrierLabel android:paddingRight="20.0dip" android:paddingBottom="20.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:gravity="right|center" android:layout_gravity="bottom" />
</FrameLayout>
<com.android.systemui.statusbar.phone.CloseDragHandle android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@id/close">
<ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:src="@drawable/status_bar_close_on" android:scaleType="fitXY" />
</com.android.systemui.statusbar.phone.CloseDragHandle>
</com.android.systemui.statusbar.phone.TrackingView>
This shows me some text at the bottom of my pull-down notifications screen then my carrier label, all above an image.
I've tried to get the two TextViews and the carrier label together (so I get "Ticklefish - Vodafone", for example) and I came up with this:
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.android.systemui.statusbar.phone.TrackingView android:orientation="vertical" android:paddingLeft="0.0px" android:paddingRight="0.0px" android:paddingBottom="0.0px" android:focusable="true" android:visibility="gone" android:descendantFocusability="afterDescendants"
xmlns:android="[URL]http://schemas.android.com/apk/res/android[/URL]">
<RelativeLayout android:background="@drawable/notification_tracking_bg" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0" android:layout_alignParentBottom="true" >
<TextView android:id="@+id/ticklefish2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:text="@string/ticklefish2" android:layout_centerInParent="true" />
<TextView android:paddingRight="6.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:text="@string/ticklefish1" android:layout_toLeftOf="@id/ticklefish2" android:layout_alignBottom="@id/ticklefish2" />
<com.android.systemui.statusbar.phone.CarrierLabel android:paddingLeft="6.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:layout_toRightOf="@id/ticklefish2" android:layout_alignBottom="@id/ticklefish2" />
</RelativeLayout>
<com.android.systemui.statusbar.phone.CloseDragHandle android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@id/close">
<ImageView android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" android:src="@drawable/status_bar_close_on" android:scaleType="fitXY" />
</com.android.systemui.statusbar.phone.CloseDragHandle>
</com.android.systemui.statusbar.phone.TrackingView>
It didn't work, all the text vanishes. I've tried all sorts of things but I can't get it to work. Anyone got any ideas?
Hi All!!
I'm going crazy to edit my mms.apk!
I want to change the size of EditText without assign static value of height, but how can I do this??
Graphically, this is what I want: (see attachment; note: the red area is as it is now my mms.apk; the green area is the results of what I want)
Part of the code to be changed I think that's (compose_message_activity.xml in res / layout):
Code:
<RelativeLayout android:layout_gravity="bottom" android:id="@id/bottom_panel" android:background="#ff737b82" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0">
<LinearLayout android:gravity="right" android:orientation="vertical" android:id="@id/sendbuttons" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="6.299988dip" android:layout_alignParentRight="true" android:layout_alignParentBottom="true">
<TextView android:textSize="15.0sp" android:textColor="#ffc7c7c7" android:gravity="right" android:id="@id/message_size" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="2.0dip" />
<Button android:textSize="15.0sp" android:textColor="@drawable/selector_send_btn_text_color" android:id="@id/send_button" android:background="@drawable/selector_send_button" android:nextFocusLeft="@id/embedded_text_editor" android:layout_width="55.0dip" android:layout_height="48.0dip" android:layout_marginBottom="3.0dip" android:text="@string/send" />
<ImageButton android:layout_gravity="center_vertical" android:id="@id/attach_button" android:background="@drawable/selector_attachment_button" android:visibility="gone" android:layout_width="1.0dip" android:layout_height="1.0dip" android:layout_marginBottom="1.2999878dip" />
</LinearLayout>
<EditText android:layout_marginBottom="3.0dip" android:textSize="17.0sp" android:textColor="#ffffffff" android:textColorHint="#ff898989" android:gravity="top" android:id="@id/embedded_text_editor" android:background="@drawable/textfield_msg" android:nextFocusRight="@id/send_button" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginLeft="3.0dip" android:layout_marginTop="5.0dip" android:hint="@string/type_to_compose_text_enter_to_send" android:capitalize="sentences" android:autoText="true" android:layout_toLeftOf="@id/sendbuttons" android:layout_alignParentLeft="true" android:inputType="textCapSentences|textAutoCorrect|textMultiLine" android:imeOptions="actionSend|flagNoEnterAction" />
</RelativeLayout>
Help please
(I'm on Android 2.3.6 Gingerbread)
How can I use my gesture overlay view with navigation drawer? I'm adding the navigation drawer to the app with gesture overlay already working. I want to just add the swipe menu and if i have to give up the swipe gesture for the just have the action bar push button is fine. I just can't figure how to combine? I get an error before the app can start saying the it can't inflate class Drawer layout. See my XML code under.
Code:
<android.gesture.GestureOverlayView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/gestureOverlayView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<ListView android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#666"
android:dividerHeight="1dp"
android:background="#333"
android:paddingLeft="15sp"
android:paddingRight="15sp"
/>
<LinearLayout
android:id="@+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dp" >
<TextView
android:id="@+id/timerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="5sp"
android:text="@string/startTime"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="30sp" />
<TextView
android:id="@+id/instructionTextView"
android:layout_width="574dp"
android:layout_height="wrap_content"
android:layout_weight="0.05"
android:textSize="40sp" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
</android.gesture.GestureOverlayView>
Hi dear developers,
I spend much time with this issue.
When I create LinearLayout with four ToggleButtons with self images, button image will not keep aspect ratio, images will be deformed.
Button images pressed in vertical, not in horizontal.
This is layout code with deformed images:
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0px"
androidrientation="horizontal">
<ToggleButton
android:id="@+id/bt1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/led"
android:text="Led"
android:textOff="BT1"
android:textOn="BT1" />
<ToggleButton
android:id="@+id/bt2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/led"
android:text="Led"
android:textOff="BT2"
android:textOn="BT2" />
<ToggleButton
android:id="@+id/bt3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/led"
android:text="Led"
android:textOff="BT3"
android:textOn="BT3" />
<ToggleButton
android:id="@+id/bt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/led"
android:text="Led"
android:textOff="BT4"
android:textOn="BT4" />
</LinearLayout>
When I create similar LinearLayout with four ImageViews instead of ToggleButtons with same images, images not will be deformed. Same images keep aspect ratio. Button images pressed in vertical and horizontal with same ratio.
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0px"
androidrientation="horizontal">
<ImageView
android:id="@+id/img1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/led" />
<ImageView
android:id="@+id/img2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/led" />
<ImageView
android:id="@+id/img3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/led" />
<ImageView
android:id="@+id/img4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/led" />
</LinearLayout>
I don't know, why it's behavior different. Size of image is 128 x 128 pixels in png file.
How I can reach that ToggleButton's image will keep aspect ratio for all relative sizes?
Application is compiled in Android Studio 3.6.1 with build gradle:
...
android {
compileSdkVersion 25
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.nabto.androidaudiodemo"
minSdkVersion 11
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
...
Thank you for your help
Srapur